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.
Asked
Active
Viewed 49 times
1
-
The two statements you quoted are in complete agreement. Unclear what you're asking. – user207421 Oct 23 '16 at 09:04
-
I'm only not sure :) I'm want to be verified :) – Tuan Nguyen Dinh Oct 23 '16 at 10:01
2 Answers
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
-
ok, thank, I'm only not sure my anwer, Now it is more obvious. Thanks. – Tuan Nguyen Dinh Oct 23 '16 at 08:06
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