我有一个内部编译器错误:java.lang.NullPointerException

时间:2016-12-07 23:26:40

标签: java eclipse

package tictactoe.board;


public class Board { 
    protected char[][] Board= new char[2][2];

    Board()
    {
        viderBoard();
    }
    private void viderBoard(){
    for (int i=0;i<3;i++){
        for (int j=0;j<3;j++){
            Board[i][j]=' ';
        }
    }
    }
    public void afficheBoard() {
         System.out.println("\t The Board");
         System.out.println( "\n\n" );
         System.out.println(  "\n\n" );
         for (int i=0;i<3;i++){
            for (int j=0;j<3;j++){
                System.out.println(Board[i][j]);
                System.out.println("|");
                System.out.println("\n _");
            }
        }
        }


    public int getPosition(int[] tab){
            return Board[tab[0]][tab[1]];
        }

    // Ajouter un mouvement à la grille
    public boolean InsererMouvement(int[] tab )
    {
        if (Board[tab[0]][tab[1]]==' ')
        {
             Board[tab[0]][tab[1]] = Joueur.getSigne();
             System.out.println("Next move");
        return(true);
        }
        else System.out.println("Try again");
        return false;
    }
    public char[][] getBoard() 
    {
        return Board;
    }



    // Check Board
    public boolean checkBoard()
    { boolean a=false;
      boolean b=false;
        // vérifier les lignes
    while(a==false)
    {for(int i=0;i<3;i++)
    {
            if ((Board[i][0]=='X')&&(Board[i][1]=='X')&&(Board[i][2]=='X')
                    || (Board[i][0]=='O')&&(Board[i][1]=='O')&&(Board[i][2]=='O')
                    || ((Board[0][i]=='X')&&(Board[1][i]=='X')&&(Board[2][i]=='X')
                    || (Board[0][i]=='O')&&(Board[1][i]=='O')&&(Board[2][i]=='O') ) )   
                a=true;
            else a=false;
    }
    }
        // vérifier les diagonales

            if ((Board[0][0]=='X')&&(Board[1][1]=='X')&&(Board[2][2]=='X')
                    || (Board[0][0]=='O')&&(Board[1][1]=='O')&&(Board[2][2]=='O')
                    ||(Board[2][0]=='X')&&(Board[1][1]=='X')&&(Board[0][2]=='X')
                    || (Board[2][0]=='O')&&(Board[1][1]=='O')&&(Board[0][2]=='O') ) 
                b=true;
            else b=false;
        if (a||b)
        return(true);
        else return(false);
    }


}

我有这个问题:

  

内部编译器错误:org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.copy(ReferenceExpression.java:141)中的java.lang.NullPointerException

我无法在任何地方找到解决方案,有人可以帮助我吗?

0 个答案:

没有答案