Is it possible to store an array to an object?
Object c = new char[50];
I got a question about this on one of my homework assignments.
Is it possible to store an array to an object?
Object c = new char[50];
I got a question about this on one of my homework assignments.
Yes, every class (including arrays) extend Object, even if not explicitly stated. As such, they are valid objects as expected in OOP.
As far as I'm aware, only primitives (int, char, boolean, etc.) aren't objects in Java, but there are classes that wrap these primitives, which are objects (Integer, Character, Boolean, etc.).
See also: They say in java "every thing is an object". Is that true?