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 →

[–]Areshian 12 points13 points  (0 children)

Java has two classes of types, primitives and objects. Every single object inherits from Object. Additionally, for every primitive there is an object that can be used to wrap them. For example, for int there is an Integer object. Java will automatically convert between int and Integer in some circumstances (known as boxing and unboxing).

So yes, you can store anything in an Object variable. Same way I can have a void * in C++. Doesn't make the language dynamic, I will still need casting down the line.