private Piece[][] board;
public cboard(){
this.board = new Piece[8][8];
}
public boolean isEmpty(int x, int y){
boolean empty= true;
if (board[x][y] != null){
empty= false;
}
return empty;
}
public void placePiece(Piece, int x, int y){
if(isEmpty(x, y)){
board[x][y] = piece;
}
}
}
這會創建一個數組的碎片? 該函數必須檢查是否該地方是空的如何在bluej中聲明一個數組?