When I run the following code it throws an java.lang.NumberFormatException and terminates.I check the code very carefully but can not find the wrong place!Can anybody help me?
I thought the character encoding may be the problem! I am in china now and the character
encoding of my platform is GB2312!
#######
import java.io.*;
public class A{
public static void main(
String args[]) throws IOException{
String qty="";
int c;
while ((c = System.in.read()) != '\n') {
qty +=(char)c;
}
System.out.print(Integer.parseInt(qty));
}
}
------------------