What's the best way to get console-input in Java?

I think, The scanner class is quite helpful. For example with BufferedReader, you have to read a line at a time and parse it for the values. But in the scanner you get integers with nextInt() method etc.


I feel Scanner is helpful in two aspects,

1) you can get input from command prompt and infuture if you want to change to file system, it will be quick

2) While reading integer inputs you don't need to parse

. I prefer Scanner.

Tags:

Java