Posts

Showing posts from October, 2020

Scanner VS BufferedReader

Image
Difference between  BufferedReader  and Scanner class in Java - File Tutorial Example   Hello guys, welcome to my blog. Today, we'll discuss another interesting Java interview  questions ,  BufferedReader  vs Scanner. It's not only important from an interview point of view but also to work efficiently with Java. Even though both  BufferedReader  and  Scanner  can read a file or user input from the command prompt in Java, there some significant differences between them. One of the main  differences  between  BufferedReader  and  Scanner  class is that the former class is meant to just read String or text data while Scanner class is meant to both read and parse text data into Java primitive types like  int ,  short ,  float ,  double , and  long .     In other words,  BufferedRedaer  can only read   String  but Scanner can read both String and other data types like int, float, long, double, float, etc. This functional difference drives several other differences in their usage, wh