Saturday, May 27, 2006

Heap & Stack memory

Space for objects created with the new operator are allocated in the heap. Method arguments or local variables of primitive types are created on the stack. Objects created in the heap have a longer lifetime.

Objects are kept on the heap, and since objects can contain instance variables of primitive types, these primitive variables are kept on the heap as well.

1 Comments:

At 7:59 PM, Blogger balaji said...

This comment has been removed by the author.

 

Post a Comment

<< Home