I am using the code snippet below, however it\'s not working quite as I understand it should.
public static void main(String[] args) {
BufferedReader
There's a nice apache commons lang library which has a good api for common :) actions. You could use statically import StringUtils and use its method isNotEmpty(String ) to get:
while(isNotEmpty(line)) {
System.out.println(line);
line = br.readLine();
}
It might be useful someday:) There are also other useful classes in this lib.