title: Why am I getting the error 'cannot find symbol' when I calculate cube numbers?
body: <p>My program has a <code>thirdPower</code> method which takes a <code>number</code> as parameter and computes the <em>third power</em> (see <a href="https://en.wikipedia.org/wiki/Cube_(algebra)" rel="nofollow noreferrer">Cube Number</a>) of all numbers from 1 to that <code>number</code>, i.e. <code>1<sup>3</sup>, 2<sup>3</sup>, ..., number<sup>3</sup></code>. The method stores the computed cubes in an array, and then prints them using a foreach loop.</p>
  <p>For example, the call</p>
  <pre class="lang-none prettyprint-override"><code>thirdPower(15);
  </code></pre>
  <p>should result in an array containing 1, 8, 27, ..., 3375.</p>
  <p>This is my code so far, but I get the error <code>cannot find symbol</code>:</p>
  <pre><code>public class Main {
      public static void main(String[] args){
           thirdPower(15);
  }
  
  private static void thirdPower(int number) {
      int[] array = new int[number];
      int count = 1;
  
      for (int i = 0; i &lt;= getal; i++) {
          array[i] = count * count * count;
          count++;
      }
  
      for (int numberYe : array) {
          System.out.println(numberYe);
      }
  }
  </code></pre>
  <p>What am I doing wrong?</p>