Thursday, July 30, 2009

Java Programming HELP?..there's an errror...?

ok...here's the code, and the error says:


cannot find symbol class IntClass





Code:





import java.util.*;


import java.io.*;





public class ex


{


static Scanner console = new Scanner(System.in);





public static void main (String[] args)


{


int first, third;


IntClass second, fourth;





first = 3;


second = new IntClass(4);


third = 6;


fourth = new IntClass(7);





System.out.println(first + " " + second.getNum() + " " + third + " " + fourth.getNum());


getData(first, second, third, fourth);


System.out.println(first + " " + second.getNum() + " " + third + " " + fourth.getNum());


fourth.setNum(first * second.getNum() + third + fourth.getNum());


getData(third, fourth, first, second);


System.out.println(first + " " + second.getNum() + " " + third + " " + fourth.getNum());


}





public static void getData(int a, IntClass b, int c, IntClass d)


{


a = console.nextInt();


b.setNum(console.nextInt());


c = console.nextInt();


d.setNum(console.nextInt());





b.setNum(a * b.getNum() -

Java Programming HELP?..there's an errror...?
A quick look makes me thing you want Integer instead of IntClass. That is, you want java.lang.Integer. That's the Java class equivalent of the int type.





However, .getNum() makes me wonder if there is some other IntClass you are using. Is there?
Reply:My husband the programmer says: there is no IntClass unless you define it. Change all instances of IntClass to Integer.





Also getNum should be changed to toString.





Also the null strings should probably be removed.


No comments:

Post a Comment