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:
This comment has been removed by the author.
Post a Comment
<< Home