title: Why java Scanner is not reading all the lines?
body: <p>Here is my code which just reads the lines from input stream and displays them but to my surprise its not reading all the lines. Its reading only upto second last line.</p>
  
  <p>Here is  my code :-</p>
  
  <pre><code>import java.util.*;
  
  public class Solution {
  
  public static void main(String[] args) {
  
      Scanner scan = new Scanner(System.in);
      short n = scan.nextShort();
      short m = scan.nextShort();
      byte[][] topics = new byte[n][m];
      for(short i = 0; i &lt; n; i++){
          char[] arr = scan.nextLine().toCharArray();
          display(arr);
  
      }
  }
  
  private static void display(char[] arr){
      for(int i = 0; i &lt; arr.length; i++){
          System.out.print(arr[i]);
      }
      System.out.println();
    }
   }
  </code></pre>
  
  <p>The input is given in this format </p>
  
  <pre><code>  4 5
   10101
   11100
   11010
   00101
  </code></pre>
  
  <p>My output is this :-</p>
  
  <pre><code> 10101
   11100
   11010
  </code></pre>
  
  <p>Its not having the third line. Why?</p>