ok heres the code im working with..

 public boolean legalMove(int row, int column)
    {

        if (a.empty(row, column) == true)
        {
            System.out.println("This sqaure is empty");
            return false;
        }
    }

now my empty method header looks like ..

  public boolean empty(int row, int column)

and the code inside for empty() works. now in the method legalMove(), i have a.empty(row, column) and when i go to compile it it says "cannot find symbol - method empty(int, int)". a is a 2d array.

why is this? how come i cant call empty() inside of legalMove(), they are both within the same class. any help appreciated. theres a seperate driver class too, but that shoulden't matter.

A 2D array doesn't have a method called empty(), which is what you are trying to call here a.empty(row,column) . You don't show your empty() method, but if it already operates on an instance level array variable, just call emtpy(row,column) . If you need that method to work against different arrays when called, you need to pass the array as a parameter to the method along with the row and column.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.