我正在阅读 JLS 关于构造函数并遇到以下内容:
If a constructor body does not begin with an explicit constructor invocation and the constructor being declared is not part of the primordial class Object
问题是我无法想象被声明的构造函数如何成为类 Object 的一部分?你能举个例子吗?
最佳答案
它只是想说明后面的语言不适用于 Object
类(因为 Object
没有父类(super class))。
它确实适用于你我可以声明的所有类。
关于java - 构造函数是 Object 类的一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26826959/