Where instance variables(primitives) are stored in java?
Primitive variables are stored in the same places all variables are stored (including references):
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With