title: Reading numbers from a .txt file into a 2d array and print it on console
body: <p>So basically i am trying to read a .txt file that contains these following in it:</p>
  
  <pre><code>3 5 
  
  2 3 4 5 10
  
  4 5 2 3 7
  
  -3 -1 0 1 5
  </code></pre>
  
  <p>and store them into 2D array and print it on console, what i got from the console is fine but only missing the first row 3 5, which i do not know what is wrong with my code made it ignored the first line.
  what i got as output now:</p>
  
  <pre><code>2  3  4  5 10 
  
  4  5  2  3  7
  
  -3 -1  0  1  5 
  </code></pre>
  
  <hr>
  
  <pre><code>import java.io.*;
  import java.util.*;
  
  public class Driver0 {
      public static int[][] array;
      public static int dimension1, dimension2;
  
      public static void main(String[] args) {
          Scanner input = new Scanner(System.in);
          System.out.println("Welcome to Project 0.");
          System.out.println("What is the name of the data file? ");
          String file = input.nextLine();
          readFile(file);
      }
  
      public static void readFile(String file) {
          try {
              Scanner sc = new Scanner(new File(file));
              dimension1 = sc.nextInt();
              dimension2 = sc.nextInt();
              array = new int[dimension1][dimension2];
              while (sc.hasNext()) {
                  for (int row = 0; row &lt; dimension1; row++) {
                      for (int column = 0; column &lt; dimension2; column++) {
                          array[row][column] = sc.nextInt();
                          System.out.printf("%2d ", array[row][column]);
                      }
                      System.out.println();
                  }
  
              }
              sc.close();
          }
  
          catch (Exception e) {
              System.out
              .println("Error: file not found or insufficient     requirements.");
          }
      }
  }
  </code></pre>