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)
{
int EvenNumbers;
System.out.println("Input Random Numbers");
EvenNumbers = new Integer(KeyboardInput.readline()).intValue();
UnArrays newUnArray = new UnArrays(EvenNumbers);
newUnArray.InputRanNumbers();
newUnArray.EvenNumbers();
Welcome to JavaRanch! Please UseCodeTags when posting code or configuration; unformatted code is unnecessarily difficult to read.
Java is case-sensitive: readline != readLine.
Soniya Ahuja
Ranch Hand
Joined: Jul 20, 2008
Posts: 83
posted
0
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
http://soniyaahuja.webs.com
Onyeabo Orji
Greenhorn
Joined: Sep 12, 2010
Posts: 3
posted
0
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.
Thanks.
Oochi
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
4
posted
0
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.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32599
4
posted
0
And I see David Newton has already given you the answer.
Onyeabo Orji
Greenhorn
Joined: Sep 12, 2010
Posts: 3
posted
0
Hi Gents,
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)
at DriverUnArray.(DriverUnArray:18)
It was difficult to even find where the input is taken in your code because you didn't UseCodeTags. Of you want people to spend their time helping you, it's important to make it easy for them. Thanks!