When I am trying to Read all the lines by using this program...It gives me one line less as an output.
Sample Program:
String line = null;
Scanner scanner = new Scanner(System.in);
while (scanner.hasNextLine()) 
{
  line = scanner.nextLine();
  System.out.println(line);
}
scanner.close();
When I give the Standarad input as:
ab
cd
ef
gh
Output is:
ab
cd
ef
 
     
    