This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am new to Java and I have written two java classes. The first class will accept an unconstrained array and then output the even numbers in the array. the first class compiled without error while the application class show the following error message which I cannot resolve:
DriverUnArray.java:19:cannot find symbol
symbol: method readline()
location: class java.io.BufferedReader EvenNumbers = new Interger(KeyboardInput.readline()).intValue();
public static void main(String args)
System.out.println("Input Random Numbers");
EvenNumbers = new Integer(KeyboardInput.readline()).intValue();
UnArrays newUnArray = new UnArrays(EvenNumbers);
Onyeabo welcome to Java Ranch! Try to read the error messages - most of the compiler messages are self explanatory
As pointed out by David - readLine is not similar to readline and hence your compiler complains that the method readline cannot be found
SCJP 1.5 | SCWCD 5 | SCJP 6.0
[url]http://a2zjava.webs.com[/url] - Online training for Java/JSPs and Servlets/SCJP/SCWCD
Joined: Sep 12, 2010
Thanks for your prompt response. I have tried to read the error messages and rechecked and could not find anyone that apply to it. ther might be something I am overlooking which is why Ihave inserted my codes.
Yes, you have overlooked something. Read the names of the BufferedReader methods very very carefully. Look at the letter after "d" and before "i". Very carefully.
Joined: Oct 13, 2005
And I see David Newton has already given you the answer.
Joined: Sep 12, 2010
Thanks you so much. The issues were resolved and the progam compiled. But when I entered the following random digits : 1 22 3 34 43 71 17 66, I goth the following error messages:
Exception in thread “main” java.lang.NumberFormatException: For input string: “1 22 4 3 34 45 71 17 66”
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown source)
at java.lang.Integer.<init>(Unknown source)