I have 2 classes. 1 class passes an ImageIcon[], and the other class takes the array and saves it.
These are the cut down versions of each class:
Class 1:
monsterLabel[] is an ImageIcon[]
saveLoad is is the name of Class2
ImageIcon[] toSave= new ImageIcon[button.length];
toSave[i]= new ImageIcon();
for (int i = 0; i < 99; i++) {
toSave[i]=(ImageIcon) monsterLabel[i].getIcon();
}
saveLoad.saver(toSave[]);
Class2(saveLoad)
public void saver(ImageIcon[] buttonPic) {}
The Problem is in class 1, Eclipse tells me
"Syntax error on token "[", Expression expected after this token"
where i’m passing toSave[]
when I put in a number ie. toSave[0], it tells me that class2 is looking for a ImageIcon[] not an ImageIcon.
How can I Pass an array?
You probably just want: