Thread: Java Error
View Single Post
  #1 (permalink)  
Old 09-04-2007, 07:05 PM
nogono nogono is offline
Novice
Join Date: Jul 2007
Posts: 35
iTrader: (0)
nogono is on a distinguished road
Icon11 Java Error

Below is my program....i am able to input the array...but i am unable to display it.......In second file...i made comment...where i think is th error..

Main file:


public
class add implements name {

input
vl;

public add()
{

vl=new input();

}







publicvoid display(int dis)
{
System.
out.println("Displaying");

System.
out.println(dis);
}

publicstaticvoid main(String[] args)
{
new add();
}

}

Second File:

import
java.io.*;


public
class input {

int[] num=newint[10];
name
mas;

public input()
{
int nu12=0;

for(int i=0;i<num.length;i++)
{

System.
out.println("Numbers Entered [ " + i + " ] = ");

BufferedReader in=
new BufferedReader(new InputStreamReader(System.in));

try {
nu12=(Integer.parseInt(in.readLine()));
System.
out.println("Passing thru array");
mas.display(nu12);//This line is not executing why so...

}
catch (NumberFormatException e) {} catch (IOException e) {} catch(NullPointerException e){}

}

}




}


Interface file:

public
interface name {

void display(int dis);

}


__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote