title: How to iterate through an arraylist of an arraylist of strings?
body: <p>I'm creating a program that allows users to interact with a file thats input.  One of the options is to display the file.  Below, I store the file into an arraylist first by creating arraylists consisting of lines, and then an inner arraylist separated of strings, separated by spaces.</p>
  
  <pre><code>Scanner sc = new Scanner(fileName);
  
      while (sc.hasNextLine()) {
          String line = sc.nextLine();
          String[] words = {};
          words = line.split(" ");
          ArrayList&lt;String&gt; lineArray = new ArrayList&lt;String&gt;();
          for (int i = 0; i &lt; words.length; i++) {
              lineArray.add(words[i]);
          }
          fileByLine.add(lineArray);
      }
      sc.close();
  </code></pre>
  
  <p>I'm trying to print the contents of the arraylist, called fileByLine, as they appear in the file, but I'm not sure how to. Any suggestion?</p>
  
  <pre><code>case '1':
  for(int i = 0; i &lt; fileByLine.size(); i++){
  for(int j = 0; j &lt; fileByLine.[i].size(); j++){
  System.out.print(fileByLine[i][j]);
    } System.out.println("");
  } break;
  </code></pre>