Moojid Hamid wrote:If Rancher extends A, and A either implicitly or explicitly extends Object
Well , But already Rancher class extends Object implicitly right ? what happend to that ? compiler will just replace that with A class ? please i need some more clarification .
Yep the compiler will just replace it with class A or whatever the compiler wants to do - I would not really bother with how it does it.
What it does is important,
Rancher class now extends A. Since in java a class can only extend one class at a time (multiple inheritance is not allowed) Rancher no longer (directly) extends object.
Class A on the other hand does not extends any class so it implicitly must extend Object. Rancher extends A so it indirectly extends Object. (Multilevel inheritance is permitted in Java).
The indirect extension does have one important implication.
Lets say the class A overrides the equals() method of the object class. Then the Rancher class will always use this over ridden equals method (unless it over rides it itself) instead of the equals method of the Object class.
Whats the context of the question? Knowing the context would help give you a better answer...