As far I know, the two most common methods of reading character-based data from a file in Java is using Scanner
or BufferedReader
. I also know that
There are different ways of taking input in java like:
1) BufferedReader 2) Scanner 3) Command Line Arguments
BufferedReader Read text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
Where Scanner is a simple text scanner which can parse primitive types and strings using regular expressions.
if you are writing a simple log reader Buffered reader is adequate. if you are writing an XML parser Scanner is the more natural choice.
For more information please refer:
http://java.meritcampus.com/t/240/Bufferedreader?tc=mm69