because the flow of the constructor goes from the super class till the other sub classes who extend that super class.
Here when c3 is called it looks up to find its immediate superclass i.e c2...c2 extends the class c1....So from there the flow of the constructor starts. Here the flow starts from C1 because it is the constructor of the superclass..Hence the output 123.
Hope that helps. [ March 13, 2008: Message edited by: ansuman mohapatra ]
the order make sense, because if we print 321, then we have to first execute all the statement in the class 3, this make us into trouble because without knowing what your parent variables are doing you cant execute you class variables.
Whenever any of the construtor get called weather its subclass constructor or superclass the execution always start from the default constructor of the superclass. That is why the o/p is 123. Your code is not OK.I did changes.
Execution goes like this
In main() method the Cert3() get called. class hierarchy goes like this cert 1 | cert 2 | cert 3
Now as the cert3()default constructor is at the last in the hierarchy so the call goes automatically to cert1() default constructor that is super class. so now the output will be like cert1() ->cert2()->cert3()