Buffer class
Written by
Buffer Class or Buffered Reader Class is another Input /Output System in Java programming that is defined within a package named ‘java.io’. Where
“IO” stands Input / Output.
To use buffer class, first, it should be imported as:
This is followed by the declaration of Buffered Class within the class so that the compiler understands the link the main program to the buffered class.
The syntax goes as:
Option 1)
BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
Option 2)
InputStreamReader bf=new InputStreamReader(System.in);
BufferedReader obj =new BufferedReader(bf);
Both the ways are equivalent and their usage absolutely depends on the preference of the programmer.