Reputation: 3919
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?
Upvotes: 0
Views: 117
Reputation: 310993
If you want a 2D array of Cell
s, you should create a 2D array of Cell
s, not of Object
s:
Cell[][] cells = new Cell[10][10];
Upvotes: 1