title: Issues with 2d array built from .txt file
body: <p>I've been able to create an array using a .txt file. However, right now when printing the array, it reprints the final row repeatedly instead of the ones that came before. I believe that I assigned the correct values and made sure to assign them to the array.</p>
  
  <p>I've tried looping through and assigning each index with correct value, and then going down each row until they are all assigned. This results in the final overriding everything however.</p>
  
  <pre class="lang-java prettyprint-override"><code>private double[][] Grid;
  
  public GridMonitor(String filename) throws FileNotFoundException
  {
      Scanner FileName = new Scanner(new BufferedReader(new FileReader(filename)));
      int totalRow = 0;
      while (FileName.hasNextLine())
      {
          String[] string = FileName.nextLine().trim().split(" ");
          totalRow++;
          Grid = new double[totalRow][string.length];
          for(int i = 0; i &lt; totalRow; i++)
          {
              for(int j = 0; j &lt; string.length; j++)
              {
                  Grid[i][j] = Double.parseDouble(string[j]);
              }
          }
          System.out.println(Arrays.deepToString(Grid));
      }
      System.out.println(Arrays.deepToString(Grid));
      FileName.close();
  }
  </code></pre>
  
  <p>It should show result something similar to</p>
  
  <blockquote>
    <p>[3.0][3.0], [2.0][10.0][7.0], [5.0][6.0][9.0], [4.0][5.0][8.0]</p>
  </blockquote>
  
  <p>but instead shows</p>
  
  <blockquote>
    <p>[4.0][5.0][8.0], [4.0][5.0][8.0], [4.0][5.0][8.0], [4.0][5.0][8.0]</p>
  </blockquote>