在 java 中,每个 class 如何在不使用 extends 关键字的情况下继承自 Object class?
In java how every class is inheriting from Object class without using extends keyword?
在 java 中,每个 class 如何在不使用 extends 关键字的情况下继承自对象 class?我们如何以同样的方式实现我们的 on java class?
In java how every class is inheriting from Object class without using extends keyword?
按规定。也就是说,因为规范在几个地方是这样说的(例如,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.
继续你的问题:
How can we implement our on java class in the same way?
你不能。
在 java 中,每个 class 如何在不使用 extends 关键字的情况下继承自对象 class?我们如何以同样的方式实现我们的 on java class?
In java how every class is inheriting from Object class without using extends keyword?
按规定。也就是说,因为规范在几个地方是这样说的(例如,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.
继续你的问题:
How can we implement our on java class in the same way?
你不能。