0

In java how every class is inheriting from Object class without using extends keyword? How can we implement our on java class in the same way?

1 Answers1

1

In java how every class is inheriting from Object class without using extends keyword?

By fiat. That is, because the spec says so, in a couple of places (for instance, here). Probably the clearest is §8.1.3:

Given a (possibly generic) class declaration C<F1,...,Fn> (n ≥ 0, C ≠ Object), the direct superclass of the class type C<F1,...,Fn> is the type given in the extends clause of the declaration of C if an extends clause is present, or Object otherwise.

Continuing with your question:

How can we implement our on java class in the same way?

You can't.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875