+ 4

What is the difference between Scanner and BufferedReader classes?

7th Aug 2016, 11:34 AM
Alberto Brandolini
Alberto Brandolini - avatar
4 Answers
+ 2
"The Java.io.BufferedReader class reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.Following are the important points aboutBufferedReader: The buffer size may be specified, or the default size may be used."(tutorialspoint.com) And the scanner pretty much does the same thing, it takes imput from user.
7th Aug 2016, 2:06 PM
Aquarius
Aquarius - avatar
+ 2
i personally use scanner because its easier. i rarely use bufferedread except for fps's. so i guess scanner is easier to use especially for beginners. i hope i helped you in any way. and im not sure theres other classes able to read user imput, because i never learned anything other then these two.
7th Aug 2016, 2:56 PM
Aquarius
Aquarius - avatar
+ 2
Thank you Aquarius, I actually learned BufferedReader before so I'm comfortable with its use but I find it weird to see two classes perform (apparently) the exact same task
7th Aug 2016, 3:35 PM
Alberto Brandolini
Alberto Brandolini - avatar
+ 1
Ok, but then what are the cases in which it's better to use one than the other? And are there other classes able to read user input?
7th Aug 2016, 2:20 PM
Alberto Brandolini
Alberto Brandolini - avatar