title: creating a matrix in java
body: <p>I want to create a matrix in java .. I implemented the following code </p>
  
  <pre><code>public class Tester {
  
      public static void main(String[] args) {
  
          int[][] a = new int[2][0];
          a[0][0] = 3;
          a[1][0] = 5;
          a[2][0] = 6;
          int max = 1;
          for (int x = 0; x &lt; a.length; x++) {
              for (int b = 0; b &lt; a[x].length; b++) {
                  if (a[x][b] &gt; max) {
                      max = a[x][b];
                      System.out.println(max);
  
                  }
  
                  System.out.println(a[x][b]);
  
              }
  
          }
  
          System.out.println(a[x][b]);
  
  
      }
  }
  </code></pre>
  
  <p>When I run the code I get the following error : </p>
  
  <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
      at shapes.Tester.main(Tester.java:8)
  </code></pre>
  
  <p>I tried different methods to correct the code but nothing was helpful
  Can you please correct the code for me ?</p>
  
  <p>thank you</p>