Object class as super class in Java

前端 未结 6 1080
生来不讨喜
生来不讨喜 2020-12-06 05:51

Why is object class the super class in Java?

6条回答
  •  悲&欢浪女
    2020-12-06 06:07

    Off the top of my head

    1. Defining 'Object' as the root class ensures the VM can rely upon the interface provided for utility methods such as equals, clone, hashcode etc

    2. The Garbage collector can ensure anything that the user deemed reconcilable can be executed in the finalize method

提交回复
热议问题