hi deepak!!!
here class test contains the main method so first the control comes to the class test where it is asked to creat an object of class b and store the adress of the object in class a's refrence. but when the jvm tries to create object of the class b first it has to create another object of class a since class b inherits class a but when it tries to create an object of class a again that contains a statement to creat an object of class b. so this becomes a recursive procedure and inturn the stack get overflowed....
this is wat it happens i guess!!!
actually when an object of a class is created.. if that class inherits some other class then first the base class object is created.
Actually an Object creation consists of 4 steps internally
1.Allocation of memory in HEAP depending on how many data members that class has
2.All the data members of that object gets default values
3.if there is any inplace intialization then that happens
4.call to constructor.
i hope this helps.