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: