title: Can Java store methods in arrays?
body: <p>Well I wrote some code and all I was doing was for loops, but changing which method I called. I tried using a for loop so it'd be a bit neater (and out of curiosity to see if it could be done), but it doesn't compile when I do it this way, because it doesn't recognize an item in an array as a method, I think. This is what I have:</p>
  <pre><code>String[] moveArray = {moveRight,moveDown,moveLeft,moveUp};
  for (i = 0; i &lt; 4; i++) {
      while (myWumpus.moveArray[i]) {
          myWumpus.moveArray[i];
          generator.updateDisplay();
      }
  }
  </code></pre>
  <p>When I try compile I get</p>
  <pre><code>not a statement myWumpus.moveArray[i]();
  ';' expected myWumpus.moveArray[i]();
  </code></pre>
  <p>(It refers to the first statement in the while loop)</p>
  <p>So, I think it's maybe because I'm making it an Array of type String? Is there a type Method? Is this at all possible? Any solutions welcome :). Also, I can get it to work using 4 while loops, so you don't need to show me that solution.</p>