doubt in java.lang.Object
Hi All,
class A{
}
class B extends A{
}
in java a class can extend only one class at a time, but
Object is super class to every other class in java.
it means now B is inheriting A and also Object .
how is it possible?
Thanks and Regards
Saida Dhanavath
It is a fact that an object can only have one parent. It is also a fact that you can only have two biological parents.
But does the fact that your parents had parents (and they had parents, etc. ad infinitum) alter anything above? Same for objects. There is a chain of ancestory that can extend quite a bit. I suggest that you study a decent Java textbook.
The super class is implicitly extending the Object class.And thus the subclass is getting the behavior and state of the the Object classYou can read Inheritence chapter of Java Certification Book by Khalid Mughal.Thnaks,mithileshwar