The heap . The nice thing about the heap is that, unlike the stack, the compiler doesn't need to know how much storage it needs to allocate from the heap or how long that storage must stay on the heap. Thus, there's a great deal of flexibility in using storage on the heap. Whenever you need to create an object, you simply write the code to create it using new and the storage is allocated on the heap when that code is executed. Static storage .
Static storage contains data that is available for the entire time a program is running.
You can use the static keyword to specify that a particular element of an object is static, but Java objects themselves are never placed in static storage. Constant storage . Constant values are often placed directly in the program code, which is safe since they can never change. Non-RAM storage . If data lives completely outside a program it can exist while the program is not running, outside the control of the program.