Wednesday, 7 December 2011

How does Java allocate stack and heap memory?

Each time an object is created in Java it goes into the area of memory known as heap. The primitive variables like int and double are allocated in the stack, if they are local method variables and in the heap if they are member variables (i.e. fields of a class).

No comments:

Post a Comment