Why do I get an exception when parsing the characters to integer using the read()
method instead of readLine()
of BufferedReader
. I tried using this code below:
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a= Integer.parseInt(br.read());
error was : cannot convert int to string.. very strange error