title: Trying to add 1 to an integer array for every value. JAVA
body: <pre><code>(int i=0; i &lt; n; i++){
  for(int j=0; j &lt; n; j++){
      Array[i][j]=Array[i][j] + 1;
      }
  }
  </code></pre>
  
  <p>for some reason I am getting an error. Array is an int array filled with 0s. n can be any size. The error i keep getting is exception in main thread for the Array line. Am I not adding 1 to the array correctly?</p>
  
  <p>edit: error was called exception in thread "main" java.lang.ArrayIndexOutofBoundsException: 3
  at (where that one line is)</p>
  
  <p>edit: it was initialized with</p>
  
  <pre><code>       Array = new int[n][n];
      for(int i=0; i &lt; n; i++){
          for(int j=0; j &lt; n; j++){
              Array[i][j] = 0;
          }
      }
  </code></pre>
  
  <p>but this doesn't seem to be a part of the error</p>