Java doesn't support multiple inheritance but implicitly every class in java extends Object and allows one more [duplicate]

Your class that extends that other class, but it extends Object, too, so you're still in one line of inheritance, not two.


No. In Java, a class can only inherit from one class and by default this is the Object class that you refer to. We can however specify a different class to inherit from (using the 'extends' keyword). However, this parent class will itself have a parent class and so on until ultimately we get back to the Object class. Perhaps an example will help:

class Animal {
}

class Cat extends Animal {
}

class Tiger extends Cat {
}

In the above example Tiger inherits from Cat which inherits from Animal which (by default) inherits from Object.

Hope this clears things up a touch.


No. You're allowed to extend only one class, but this class can itself extend another one. If you don't specify any superclass in the extends clause, you extend from Object directly. If you specify a class in the extends clause, you extend from this class, which extends its own superclass, etc., until Object.


Every Java class that does not specify an extension automatically extends Object. Therefore, if you extend from another class there will be some endpoint extension that does not extend a class and defaults to Object. This causes every class to transitively extend Object.