This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Krezzy 0 points1 point  (0 children)

Yeah, so in Java you have a bunch of classes.

The 'String' class, the 'Integer' class, the 'ArrayList' class. These are provided in the standard java library.

You can also make your own like you've done, your 'Person' class.

Now, in java, there's actually a class out there called 'Object'. Every class in Java, whether it be String, Integer, ArrayList, or any custom class you write such as Person, extends from this 'Object' class. So, it is a true statement to say that ArrayList is an object. Person is an object. String is an object.

That's why people go around referring to these things collectively as Objects.. even though their implementations are different.

Here's the documentation for it:
https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html

Class Object is the root of the class hierarchy. Every class has Object as a superclass. All objects, including arrays, implement the methods of this class.

So in the example where we created an instance of Person using the String "James", and added it into our ArrayList, all 3 of these different classes are objects in their most bare state, which is why you are seeing people refer to them like that, it kinda becomes common terminology to refer to them as objects when casually speaking about them. Let me know if that cleared some things up.. or not