0
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);
    }


}

I have this issue:

Internal compiler error: java.lang.NullPointerException at org.eclipse.jdt.internal.compiler.ast.ReferenceExpression.copy(ReferenceExpression.java:141)

I couldn't find the solution anywhere, could someone help me?

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114
Karmoussfull
  • 1
  • 1
  • 2
  • 3
    For an internal compiler error: 1) report the bug to the Eclipse team if you can, and 2) try commenting out parts of your code until it doesn't occur, then carefully inspect the part you commented out that made it not occur. – user253751 Dec 07 '16 at 23:28
  • 1
    [This looks like the same bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=500503), but then again you don't have a `:` instead of a `::` anywhere in your code. Can you include the full text of the error, and/or narrow down your search on the Eclipse bug database please? – Ken Y-N Dec 07 '16 at 23:37
  • 2
    BTW, this isn't a dup! It's the Eclipse internal compiler that's blowing up, not the OP's code. – Ken Y-N Dec 07 '16 at 23:38
  • 2
    @KenY-N Yes, this question should be closed as off-topic (just a bug report, really), not as a duplicate of another `NullPointerException` question. – Ken Wayne VanderLinde Dec 07 '16 at 23:47
  • Show us the full stack trace. What version of Eclipse are you using? – greg-449 Dec 08 '16 at 08:23
  • I am sorry I responded this late to you guys, thanks for all the suggestions, the solution I found was making a whole new project with the same code and the error disappeared. ( PS: I'm sorry if I have any errors in english it's not my native language) – Karmoussfull Dec 10 '16 at 11:02

0 Answers0