posted 17 years ago
Hi Guys,
what is wrong in the following code??
public class ShirtArrayTest
{
Shirt shirt1 = new Shirt(1,"nice shirt1",'R',15.00,60);
Shirt shirt2 = new Shirt(2,"nice shirt2",'R',14.00,50);
Shirt shirt3 = new Shirt(3,"nice shirt3",'R',13.00,40);
Shirt shirtArray[] = new Shirt[3];
shirtArray[0] = shirt1;
//shirtArray[1] = shirt2;
//shirtArray[2] = shirt3;
}
i get a ']' expected and a <identifier. expected. evertthing compiles fine until i put in the line shirtArray[0] = shirt1; i have tried type casting the entry shirtArray[0] = (Shirt)shirt1; but i geteven more errors.
please help i have been staring at this code for 30min and i cant seem to find the problem.
thanks
Bryan