JAVA memory classified into five sections:
1, the stack (stack): are methods stored in local variables. Method of operation must be run on a stack of them.
Local variables: parameters of the method, when the fire inside the {} method variables.
Scope: Once you go out of scope immediately disappear from the stack memory of them.
2, the heap (Heap): Any new out of something, are among the heap.
The stuff inside the heap memory has an address value: Hex
Heap memory inside data have default values. rule:
The default is an integer from 0 ----
Float --- The default is 0.0
--- The default character is' \ u0000
The default is false boolean ---
The default value is null reference type ---
3, a method to (Method Area): storage .class related channel information, the method comprising the information.
4, native method stacks (Native Method Stack :): associated with the operating system.
5, register (PC Register): associated with CPU
for example:
public static void main(String[] argc){
int[] arrayA = new int[4];
}
arrayA this is a local variable, the contents of the address of the array, which is stored in the stack, and four members of the array is stored in the heap.