Java 5 introduces a new class named Scanner. This class provides the best way to work with stream of character.
Using the class, you can reduce the code to read and process any character stream, that’s include file or any other input stream. That means you can also use System.in for getting input interactively from user in a console application (something that is very hard to do with previous Java version).
For more information about Scanner, see the tutorial in Sun.