difference between scanner and bufferedreader | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

difference between scanner and bufferedreader

I'm not getting the difference. ...

31st Jan 2017, 4:09 AM
Zameer shaikh
Zameer shaikh - avatar
1 Answer
Scanner class can parse the user input and read int, short, byte, float, long and double apart from String. On the other hand BufferedReader can only read String in Java. Another difference is that BufferedReader is synchronized while Scanner is not. This means, you cannot share Scanner between multiple threads but you can share the BufferedReader object.
2nd Feb 2017, 7:15 AM
Tithi Ghosh
Tithi Ghosh - avatar