Sample program for aggregation

Sample program for aggregation


class MainTest 
{
Test1 t1;
Test2 t2;
Test3 t3;
MainTest(Test1 t1,Test2 t2,Test3 t3)
{
this.t1=t1;
this.t2=t2;
this.t3=t3;
}
void disp()




{
System.out.println("Test       "        +t1.a+"              "        +t1.b+"            "           +t1.c);
System.out.println("Test       "        +t2.ch1+"            "         +t2.ch2+"         "           +t2.ch3);
System.out.println("Test"        +t3.b1+"             "          +t3.b2);
}
public static void main(String[] args) 
{
Test1 x=new Test1(10,20,30);
Test2 y=new Test2('a','b' ,'c');
Test3 z=new Test3(true, false);
MainTest mn=new MainTest(x,y,z);
mn.disp();
}
}