+ 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 ?
3 Réponses
+ 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 :)
+ 2
Thnx Snehith ...its really helpfull
0
yep