title: Arrays and Files in Java
body: <p>So I've recently switched from Python into learning Java and i'm having trouble getting 2d arrays to work. I managed to get reading from the file working and appending the text in the file into an array. But I only managed to get as far as writing the contents of the file into an array as one item. Being fluent in Python means that I would consider myself to be quite understanding of how constructs work, its just i'm struggling to adjust to what library/method to use in doing this. </p>
  
  <p>This is the contents of the text file I would like to split into an array line by line.</p>
  
  <pre><code>    Mildred Bush 45 65 45 67 65 into [[Mildred Bush],[45],[65],[67],[65]]
      Fred Snooks 23 43 54 23 76               etc.
      Morvern Callar 65 45 34 87 76            etc.
      Colin Powell 34 54 99 67 87
      Tony Blair 67 76 54 22 12
      Peter Gregor 99 99 99 99 99
  </code></pre>
  
  <p>Code without arrays working. </p>
  
  <pre><code>    public void Process() {
      String filename;
      filename = "Details.txt";
  
  
      FileReader fileReader = null;
      BufferedReader bufferedReader = null;
  
      List&lt;String&gt; alist = new ArrayList&lt;String&gt;();
  
  
      try{
  
          fileReader = new FileReader(filename);
          bufferedReader = new BufferedReader(fileReader); 
  
          String nextLine = bufferedReader.readLine();
  
          while ((nextLine = bufferedReader.readLine()) != null) {
              System.out.println(nextLine);
              nextLine = bufferedReader.readLine();
              nextLine.split(",");
              System.out.print(nextLine);
              alist.add(nextLine);
          }
      }
      catch (IOException e){
          System.out.println("Error reading from file: " + e);
      }
      System.out.print(alist);
  
  }
  </code></pre>
  
  <p>So the way I was going to go about it was by using .split twice, splitting by "\n" then " ". To create a 2d array. But i couldnt get this working and I was wondering if there was a different library/method to use to read each line of a file into a 2d array. I looked into using the ArrayList module(?) with again no success of getting eachline line to split.</p>