Possible Duplicates:
Whats up with static memory in java?
What is the actual memory place for static variables?
In which memory static variables,local variables are presents like object is leave in heap
Possible Duplicates:
Whats up with static memory in java?
What is the actual memory place for static variables?
In which memory static variables,local variables are presents like object is leave in heap
When you do a heap dump you get all the static values. The heap dump shows that static fields are in a special object for that class. You can access this "object" in the Sun/Oracle JVM by using the Unsafe class.
While local values are on the stack, eg. a reference, any object this references in on the heap. (Unlike languages like C++)
e.g.
String hi = "hello";
The reference hi
in on the stack but the Object (which is most of the memory) is in the heap.