quote:
if an explicit call to another constructor is made using this(..),then the superclass constructor is not called until the other constructor runs I write a program to
test it:
1.class Super {
2. Super(){System.out.println("Super");}
3.}
4.class Based extends Super {
5. Based() {this(20);System.out.println("Based");}
6. Based(int i) {
7. System.out.println(i);
8. }
9. public static void main(
String []fred) {
10. Based ba1= new Based();
11. }
12.}
I expect the result is
From the above quoted)
20
Based
Super
But the actual result is:
Super
20
Based
My question is why generate such result? and what does RHE mean by saying that?
kai