title: reach the last line with end of line in java
body: <pre><code>Scanner console = new Scanner(System.in);
  String line = "";
  String pera = " ";
  
  System.out.println("Enter the text : ");
  InputStreamReader isr = new InputStreamReader(System.in);
  BufferedReader buf = new BufferedReader(isr);
  int lineNum = 0;
  do {
      line = buf.readLine();
      System.out.println();
      pera = line + "";
      lineNum++;
      System.out.print(lineNum + " " + pera);
  } while (line != null);
  isr.close();
  buf.close();
  </code></pre>
  
  <p>input : 
  Hello world
  I am a file
  Read me until end-of-file.</p>
  
  <p>output : 
  1 Hello world
  2 I am a file
  3 Read me until end-of-file.</p>
  
  <p>and this code output is : 
  1 Hello world
  2 I am a file
  3 Read me until end-of-file.
  4 null  </p>