Java: Rationale of the Object class not being declared abstract

后端 未结 10 1081
粉色の甜心
粉色の甜心 2020-12-06 04:54

Why wasn\'t the java.lang.Object class declared to be abstract ?

Surely for an Object to be useful it needs added state or behaviour, an Object class is

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 05:17

    As always, Guava comes to help: with http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/base/Optional.html Stuff here can be used to kill nulls / Object instances for "a not-null placeholder" from the code.

    There are entirely seperated questions here:

    • why did not they make Object abstract?
    • how much disaster comes after if they decide to make it abstract in a future release?

提交回复
热议问题