title: Accessing object-type methods from an object array java
body: <p>My problem is I'm trying to make a console based chess game. Starting off with an Object array to hold the squares of the chess board.</p>
  
  <pre><code>class Chessboard {
      Object[][] board = new Object[10][10];
  </code></pre>
  
  <p>I fill it out perfectly with various if-sentences like this: </p>
  
  <pre><code>for (int i = 0; i &lt; 10; i++) {
      for (int j = 0;j &lt; 10; j++) {
          if a position on a chess demands a specific piece:
                   board[i][j] = new ChessPiece(String firstLetterOfPiece, i, j);
          else fill in blanks:
                   board[i][j] = new ChessPiece(" ", i,j);
      }
  }
  </code></pre>
  
  <p>Now, I have some find position methods in the <code>ChessPiece</code> class that just gives a compiler error when I try it from the class Chessboard.</p>
  
  <p>What I do is: (to test)</p>
  
  <pre><code>System.out.println(board[2][4].getXposition());
  </code></pre>
  
  <p>I get "Cannot find symbol".
  What can I do to avoid this?</p>