I am an applied science student. We are dealing with the memory allocation models of creating new objects, calling methods, etc.
I have one specific question (for now):
If the type of the reference variable of an object is changed by type casting to the type of its super class, where in the memory (heap, stack or similar) is this type saved?
where exactly in the heap, it isn't in the class reference, because another reference variable could still refer to the object on the heap, so where in the heap is this information stored?
Could you post a little snippet of exactly what you mean. The link you gave doesn't seem to be available.
If what you mean is something like this:
String s = "This is a string.";
Object o = s;
And your question is "where is the information that says o is an Object?" then I would say that there is a reference variable on the stack of type Object, which refers to an instance of a String in the heap. So the object on the heap knows what it is, but the reference variable on the stack isn't as certain about what it is referring to. The object is always a String regardless of what type(s) of reference refer to it.