It depends what you mean by "elements". Objects can be elements in an array or an ArrayList. But if you mean "primitives" instead of "elements" then yeah, Objects and primitives are different.
Type: Posts; User: KevinWorkman
It depends what you mean by "elements". Objects can be elements in an array or an ArrayList. But if you mean "primitives" instead of "elements" then yeah, Objects and primitives are different.
Like I said, arrays definitely CAN contain primitives, but they don't HAVE to. They con contain Objects as well. So to say the can only contain a single data type is not correct. I don't want to be...
I'm still not sure I agree with that. Arrays definitely can contain primitives (whereas ArrayLists can only contain Objects, including wrapper classes for primitives). But arrays can also contain...
I just woke up and I haven't tested this, but couldn't you store multiple types in an array by doing something like this:
Object[] objs = {new Object(), "cats", 7};
An ArrayList is an Object that holds a variable amount of other Objects.
An array is a container that holds a fixed number of Objects or primitives.
They aren't the same, and what you've...
That's an array, not an ArrayList.