I'm a college student. So this problem may be a little silly. Thanks
to help me.
Why it always throw the NumberFormatException?
---------------------------------------------------------------------------------------------------------------------
ArrayList<Integer> inputNum = new ArrayList<Integer>();
try {
System.out.println(" Please input an integer:");
while (true) {
byte buffer[] = new byte[128];
System.in.read(buffer);
if ("end".equals(buffer.toString().trim())) {
break;
}
else {
inputNum.add(Integer.parseInt(buffer.toString().trim()));
}
}
}
catch (IOException e) {
System.out.println(e.toString());
}
catch (NumberFormatException e) {
System.out.println("Please input an integer.");
}
--------------------------------------------------------------------------------------------------------------------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---