0

I’ve written the code

Object[][] cells = new Object[10][10];

which I am hoping to later cast to

cells = (Cell[][]) cells;

but when I do I get a syntax error saying that it did not expect a semicolon where I have placed it, but instead expected what looks like white space. If this is not the correct way to construct a 2D Object array then what is?

1
  • 2
    Your code does not make any sense. Post complete class that gives you this compilation error. Commented Dec 4, 2020 at 22:51

1 Answer 1

1

If you want a 2D array of Cells, you should create a 2D array of Cells, not of Objects:

Cell[][] cells = new Cell[10][10];
Sign up to request clarification or add additional context in comments.

Comments

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.