difference between Scanner & BufferReader [duplicate]

suppose in the consol, you entered

10 20 

and then press ENTER key

The first case will return 10 but the second case will not compile, because readLine() returns String not int.

In case if you try to parse that returned String to int, then also it gives NumberFormatException, as it reads the complete line, which contains two numbers along with a WHITE SPACE

Browse More Popular Posts

Leave a Comment