为什么java“最高"?称为“对象"的超类? [英] Why is java "highest" superclass called "Object"?
问题描述
我有一个奇怪的(也许是愚蠢的)问题:我想知道....为什么 javaObject"类称为Object",而不是Class"?
I have a strange (and maybe silly) question: I was wondering.... why is java "Object" class called "Object", not "Class"?
例如,对于具有以下层次结构的 ArrayList
For example, for ArrayList whe have the following hierarchy
Object ->
Collection ->
List ->
ArrayList
好的:ArrayList 是一个列表......列表是一个集合......但是一个集合(所有集合的类)不是一个对象......它是一个类!
Ok: ArrayList is a List... List is a Collection... but a Collection (the class of all collections) is not an Object... it is a class!
推荐答案
想想对象本身是什么.ArrayList
是一个列表,是吗?也是一个对象.它不是一类对象.类名描述了该类的实例代表什么.
Think about what the object itself is. An ArrayList
is a list, yes? It's also an object. It's not a class of object. The class name describes what instances of that class represent.
一个集合不是一个集合类——它是一个一个集合(而且它是一个对象).
A collection isn't a class of collections - it's a collection (and it's an object).
这篇关于为什么java“最高"?称为“对象"的超类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!