Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is java "highest" superclass called "Object"?

Tags:

java

object

oop

I have a strange (and maybe silly) question: I was wondering.... why is java "Object" class called "Object", not "Class"?

For example, for ArrayList whe have the following hierarchy

Object ->
Collection ->
List ->
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!

like image 842
Salles Avatar asked May 16 '26 05:05

Salles


1 Answers

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).

like image 54
Jon Skeet Avatar answered May 18 '26 18:05

Jon Skeet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!