2

I'm creating an array of objects. The 'Board' constructor needs to create an array of 'Space' objects. Currently, this is how I'm doing it.

public class Board {
    //...

    public void Board(int len){
        //...
        Space[] array = new Space[len];
        for(int i=0; i<array.length; i++){
            int[] stuffs = new int[4];
            //...
            array[i]= new Space(i, stuffs, 0, 0);
        }

I've removed a bunch of irrelevant code and replaced it with //..., as it does not give errors and is not related to the problems I am experiencing. If you would like to see that code, you can ask for it, but I seriously doubt it's related to the problem.

Right now, I get the following error:

Board.java:42: cannot find symbol
symbol  : constructor Space(int,int[],int,int)
location: class Space
            array[i]= new Space(i, stuffs, 0, 0);
                      ^

I have no idea how to resolve the issue. What do?

2
  • what does the constructor of Space look like? Commented Dec 23, 2011 at 16:26
  • 3
    I've removed a bunch of irrelevant code. The most relevant code would be the Space constructors. Commented Dec 23, 2011 at 16:26

1 Answer 1

6

You don't have a Space constructor with signature Space(int, int[], int, int). You need to look at what constructors are available in Space.

You may be including the array index unnecessarily?

Sign up to request clarification or add additional context in comments.

1 Comment

or maybe you have the constructor but is not accessible?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.