What is the Difference between Scanner class and BufferReader class ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the Difference between Scanner class and BufferReader class ?

both the classes are used to take input from user but when to prefer Scanner or BufferedReader ? and why ?

18th Jan 2017, 10:01 AM
amit umbarkar
amit umbarkar - avatar
3 Answers
+ 4
BufferReader only reads the input, while Scanner both reads and parses the input. In case if someone reading this doesn't know what parsing means, BufferReader could only read a ' String ' from a file or user input, whereas Scanner can read ' Strings ' and also other primitive data types like int, float, short, long, double, etc. This procedure is called parsing the data types. and by the way, that's a very good question :)
18th Jan 2017, 5:41 PM
Snehith Haridas
Snehith Haridas - avatar
+ 2
Thnx Snehith ...its really helpfull
18th Jan 2017, 7:21 PM
amit umbarkar
amit umbarkar - avatar
0
yep
2nd Feb 2017, 4:05 PM
Amrit Saluja
Amrit Saluja - avatar