Professional Documents
Culture Documents
Bufferedreader Class in Java
Bufferedreader Class in Java
There are two ways to take input from the user in Java
Using Scanner Class(java.util package)
Using BufferedReader Class(java.io package)
Scanner and BufferedReader both classes are used to read
input from external System.
Scanner is normally used when we know input is of
type String or of primitive types and BufferedReader is
used to read text from character Stream.
BufferedReader has significantly large buffer(8 KB)
than Scanner(1 KB) which means if you are reading long
string from file, you should use BufferedReader but for
short, input and input other than String, you can use
Scanner class.
Syntax of BufferedReader Class
BufferedReader br=new BufferedReader(new InputStreamReader(System.in))
Class nm object Inbuilt class take data from keyboard