That means, whenever you create an object as static or local, it gets stored in heap . All the class variable primitive or object references (which is just a pointer to location where object is stored i.e. heap) are also stored in heap.
That means, whenever you create an object as static or local, it gets stored in heap . All the class variable primitive or object references (which is just a pointer to location where object is stored i.e. heap) are also stored in heap.