This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I was shocked to see the Subject of this post! Anyways I dont know how to explain. May be other Ranchers will be able to add relevant information.
The whole idea of not allowing multiple inheritance was to avoid the Deadly Diamond of death. But in the query raised by you I dont see any kind of such violation. And with overriding and Polymorphism, the JVM will know which method to call even if the particular Class extends Thread and it in turn Object (and Object contains fixed number of methods).
2. And if we extend another class, say java.lang.Thread, then clearly your class is said to be implementing Multiple Inheritance.
I think you are saying this because you have the feeling that you are extending Thread and Object, right? Well, the thing is, you are only extending Thread, and Thread extends Object. So it is indeed possible to only extend one class, and thus no multiple inheritance.
I have got my answers after I discussed the above issue with my colleague.
The explanation is as follows:
1. A class extending itself is called as Cyclic Inheritance. And no OO programming language in this world supports Cyclic Inheritance. 2. In Kathy's book, it was written as "Other than objects of class Object, all java objects are polymorphic as they pass the IS-A test for their own type and for the Object class". 3. And when you extend, say java.lang.Thread class, then your class does not extend Object, they extend Thread which in turn extends Object. This becomes Multi-level inheritance instead of multiple inheritance.
If your class is extending Thread Class then the Object class automatically comes in the hierarchy,so it won't be multiple inheritance but multi-level inheritance.
Your class extending Thread which in turn extending Object.