Let me explain I have a class X
public class X
{
private List<Y> y;
}
I have another class Y
public class Y
{
int a ;
Private List<Z> z;
}
Now i want to mannually assign some values to class Y object whitch is an array of obejcts of size 2. Now i have added the values. How can i add this to the object of class X, in which a propery of type List of Class Y exists. Hope am able to explain it correctly.
i have
Y [] y1= new Y[2];
y1[0] = new Y();
y1[0].a=1;
y1[1]=new Y();
y1[0].a=2;
How can i assign y1[0] and y1[1] to object of X.
X x1=new X();
x1.y.add(y1[0]);
x1.y.add(y1[1]);
Its failing...
Please help me .