title: How to access an array from another class that is private in Java?
body: <p>I have 2 classes set up in a project where i am creating a primitive chess game. I am trying to access an array from another class but it's private. How would i go about referencing and accessing that array from a different class? Here are the sections of relavent code:</p>
  
  <pre><code>private static final char FREE         = '.';
  private static final char WHITEROOK    = '♖';
  private static final char BLACKROOK    = '♜';
  private static final char WHITEBISHOP  = '♗';
  private static final char BLACKBISHOP  = '♝';
  
  private int boardsize;
  private char[][] board;
  
  public Board() {
      this.boardsize = DEFAULT_SIZE;
  
      board = new char[boardsize][boardsize];
  
      // Clear all playable fields
      for(int x=0; x&lt;boardsize; x++)
          for(int y=0; y&lt;boardsize; y++)
              board[x][y] = FREE;
  
      // Placing Initial Pieces on the board
      board[2][0] = WHITEBISHOP;
      board[5][0] = WHITEBISHOP;
      board[2][7] = BLACKBISHOP;
      board[5][7] = BLACKBISHOP;
      board[0][0] = WHITEROOK;
      board[7][0] = WHITEROOK;
      board[0][7] = BLACKROOK;
      board[7][7] = BLACKROOK;
  }
  </code></pre>
  
  <p>It's the board array that I want to access, and use to compare to other arrays within if statements.</p>
  
  <p>Thanks!</p>