1

I guess that answer may be "a class is not explicitly inherit, will implicit inherit Object class". But i'm not sure, in Oracle Doc, ... they all said : all class object implicit inherit Object class.

2 Answers2

1

A class always has a single direct super-class, but it can have multiple ancestor classes (if class C extends B and class B extends A and class A extends Object, C has a single direct super-class - B - and 2 indirect super-classes - A and Object). If you don't specify the super-class in your class definition, the direct super-class will be the Object class by default.

If you specify a direct super-class in your class definition, that class would be the only direct super-class of your class. Object will still be an ancestor of your class, but it won't be the direct super-class of it.

Eran
  • 387,369
  • 54
  • 702
  • 768
0

What they are trying to say is this:

This declaration:

class Foo
{
    ...         
}

Is the same as this one:

class Foo extends Object
{
    ...         
}
selbie
  • 100,020
  • 15
  • 103
  • 173