Reputation: 6691
Where instance variables(primitives) are stored in java?
Upvotes: 4
Views: 4692
Reputation: 12214
Primitive variables are stored in the same places all variables are stored (including references):
Upvotes: 8
Reputation: 43
After class loader loads classes with qualified name into the jvm . JVM parse the binary data from the class and place that info into the Method area. When JVM executes the class it first place the Objects (including instance fields primitive/non primitive) into the heap.
Upvotes: 0
Reputation: 169478
If you mean instance fields declared on a class, they are allocated on the heap as part of the object's own allocation.
Primitive (value type) variables declared as method locals are stored in the method's stack frame.
Upvotes: 2