Let\'s say we have a class:
class Class1
{
int i = 1;
}
and we have a variable:
Class1 ob1 = new Class1();
Does a reference itself stored in a variable ob1 store the information that it refers to an object of Class1?
NO. Reference variable ob1
stores only the reference of the object it points to. And the information about that object is already known to the application (or JVM).
Does the part of the heap where Class1 is stored store the information that it is of Class1 type?
NO. The information about class being loaded is stored in method area. As specified in this link
For each type it loads, a Java virtual machine must store the following kinds of information in the method area:
How does logically looks like this information? It's a string like application1.Class1 or a reference to some reference types pool?
Inside the Java class file and Java virtual machine, type names are always stored as fully qualified names. For example, the fully qualified name of class Object in package java.lang is representated as java/lang/Object. In the method area, fully qualified names can be represented in whatever form and data structures a designer chooses.