I am trying to declare an Array of Rectangles in java but I can't figure out how. Here is my code:
private Rectangle rectArray[] = new Rectangle[9];
rectArray[0] = new Rectangle(0,0,0,0);
I tried commenting out the second line and it works fine, but when I leave the second line in, it has the error:
Syntax error on token ";" expected {
It's not declaring the Array that's the problem; initializing it is the problem. How can I fix this error?
{ }characters, but it's probably not what you want to do.