title: Java 2d array, test for square
body: <p>I'm given an array (a2d) and I need to determine if every row and column has the same number of elements as every other row and column. If it is then I set the Boolean isSquare to true.</p>
  <p>I have come up with the following code, but it doesn't like it and it isn't giving me any suggestions on how to improve it.</p>
  <pre><code>for(int row = 0; row &lt; a2d.length; row++){
  for(int col = 0; col &lt; a2d[row].length; col++)
      if(a2d.length == a2d[row].length)
          isSquare = true;
      else
          isSquare = false;
  }
  </code></pre>
  <p>Am I testing this the wrong way or is there a better way?</p>