Internally speaking, when you cast an object to a strongly typed object like:
User u = (User)o;
Where is the type of the object stored? is it stored in another location or within the memory block where the actual object is stored?
(I don’t know much about this topic, so I could very well be asking a question that doesn’t make complete sense, but I hope you get the gist of it)
The header of each object contains a reference to the type of the most derived implementation class. Much like a “vtbl” in C++. Typically this will be a “C” structure rather than a Java object. I believe Azul’s (64-bit) version of Hotspot use a 32-bit compact pointer to shorten the header size.