title: Return number of rows in 2d array?
body: <p>I have this 2d array:</p>
  
  <pre><code>private boolean[][] landscape;
  </code></pre>
  
  <p>this landscape array defines a pond with its [rows] and [cols]  </p>
  
  <p>The method, <code>public int getRows()</code>, needs to return the number of rows in the landscape array</p>
  
  <p>I tried just <code>return landscape.length;</code> and that didnt work.  Couple more things I tried without success:</p>
  
  <pre><code>        int count = 0;
          for (boolean[] i : landscape){
              count += i.length;
  
  
          }
          return count;
  </code></pre>
  
  <p>And</p>
  
  <pre><code>       int count = 0;
  
          for (int i = 0; i &lt; landscape.length; i++) {
  
                  if (landscape[i] != null){
                      count ++;
  
              }
  
          }
          return count;
  </code></pre>
  
  <p>The amount of rows and cols depends on what the user selects I believe.  There is a minimum of 5.  So how would i do this?</p>