You must be running the code in Eclipse, the error message on the console is different.
Yes Ankit,you are right..
Solution, use a statement like new Practice1().super();...
I think,mathew is right.why do we create a separate object for calling the super().because we already have the object of Practice1.
But i am still in doubt.
calling a Practice1.this.super() or new Practice1().super()(an extra call to constructor)both are going through same route.
first calling the B constructor and than Practice1.
but i am not able to understand these two codes clearly..
I am telling you what i am thinking about this..
before calling the super() we have three objects
1 of B
1 of C
1 of Practice1
objects of B and C are associated with object of Practice1
C also extends B.so,when we call the super() it should call the constructor of its supertype but there is an error.
if we use Practice1.this.super()
//here the confusion comes into play
we have a single object of Practice1 but we are connected to it through the ways:
1. through association of C
2. through class B which it extends
Practice1.this.super() refers to Practice1 object.so,it should call Practice1 constructor but it is going through class B constructor.why does it choose that way??
this.super() refers to which one??