title: Can't access the values of nested list elements, Java 8
body: <p>First of all, I easily got this to work with the regular way of populating and accessing data from an array, so that as a suggested solution isn't what I'm looking for. I'm trying to better understand how to populate and access data from a multi-dimensional array. When I run the program the NetBeans error message is: <code>cannot find symbol</code>, <code>symbol: method get(int)</code>, <code>location: class Integer</code>. I've looked at the <code>.get()</code> method for <code>ArrayList</code> and to me it seems like I'm correctly trying to access that data but something isn't right. Also, on the last statement of the program code NetBeans says <code>incompatible types: ArrayList&lt;Integer&gt; cannot be converted to Object[]</code>. I'm guessing that's because when I'm trying print the values of each nested element each value wants to be accessed as a <code>String</code>, it's just a guess.</p>
  
  <p>So the the array I want to populate should look like this: <code>[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]</code>, and output should look something like below.</p>
  
  <p><code>1 2 3 4
  5 6 7 8
  9 10 11 12</code></p>
  
  <pre><code>// TwoDimensionalArray_v2.java
  // demonstrates populating and accessing elements from a two-dimensional array
  
  package twodimensionalarray_v2;
  
  import java.util.*;
  
  public class TwoDimensionalArray_v2 {
    public static void main(String args[]) {
      // declare a dynamic array of class type Integer
      ArrayList&lt;Integer&gt; table = new ArrayList&lt;&gt;();
  
      // loop variables
      int i, j;
  
      // populate the array one nested element at a time
      for (i = 0; i &lt; 3; ++i) {
        for (j = 0; j &lt; 4; ++j) {
          table.set(i, (i * 4) + j + 1);
          // &gt;&gt;&gt;&gt;&gt; NetBeans error message is for the below line on .get(j) &lt;&lt;&lt;&lt;&lt;
          System.out.print(table.get(i).get(j) + " ");
        }
        System.out.println();
      }
  
      // print 'table'
      System.out.println();
      System.out.println(Arrays.deepToString(table));
    }
  }
  </code></pre>