Where does the Java store the final member and static member?
I know that the static method and non-static method of a class all store in the method area.
But I am really in doubt that where does Java stores the final variable(constant) members and static variable members of an object.
For example,
class A{
private final int a = 1;
private static int b = 2;
private static final int c = 3;
//other codes...
}
I wonder where does Java store a,b,c in the memory. Heap,Stack,or Method area?
======update=====
Hey,Thanks for your help.And please allow me to share a link about the components of jvm:http://www.artima.com/insidejvm/ed2/jvm2.html
Inside a Java virtual machine instance, information about loaded types is stored in a logical area of memory called the method area
.Memory for class (static) variables declared in the class is taken from the method area.
All instance variables will be stored in heap area
, including final members.
上一篇: 静态成员在内存中的位置是永久生成的吗?