title: how can i access a Java array element by using a variable?
body: <p>I have prepared some Arrays that i will want to use later:</p>
  <pre><code>int[] A1a=new int[20];
  int[] B1a=new int[30];
  int[] A1b=new int[20];
  int[] B1b=new int[30];
  int[] A2a=new int[20];
  int[] B2a=new int[30];
  int[] C2a=new int[40];
  int[] A2b=new int[20];
  int[] B2b=new int[30];
  int[] C2b=new int[40];
  int[][] all={A1a, B1a, A1b, B1b, A2a, B2a, C2a, A2b, B2b, C2b};
      
  </code></pre>
  <p>After im asking in main method the user to type the room &quot;A B C&quot;, the movie &quot;1 2&quot; and the time &quot;a b&quot;. When he does that im connecting them together and im making the name of an Array.</p>
  <p>How can i use that name to call the array??</p>
  <p>That is what im doing but obviously it doesnt work :(...</p>
  <pre><code>public void showSeats(String room, int movie, String time) {
      String pinakas=room+movie+time;
      for (int i=0; i&lt;(&quot;pinakas&quot;.length); i++){
          System.out.print(&quot;pinakas&quot;[i]);
      }
  </code></pre>
  <p>*saying he typed 'A' '2' 'a' the &quot;pinakas&quot; will be &quot;A2a&quot; as a String</p>
  <p>In conclusion after i make the arrays im practically asking the user what array would be used. But me asking him to type &quot;char&quot;, &quot;int&quot;, &quot;char&quot; and after that connecting those getting &quot;A2a&quot; in a string variable HOW can i use that string variable to call the array.</p>