I have this method getData as shown . It is expecting an array of bag Objects as shown please see the code below :
public static String getData(Bag[] bag)
{
}
public class Bag
{
public char side;
}
But , when i tried i am getting ClassCastException . I have done this way :
Object bagArray[] = new Object[1];
Bag bagData = new Bag();
bagData.side = S ;
bagArray[0]=bagData;
String bagData = ApplicationUtil.getData(Bag[]) bagArray);
请让我,如何解决这一错误?