This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Just to add, object references are stored in the stack if created within a method, else it is stored in the heap. Objects created are stored on the heap. Stack memory is the programs memory and Heap memory is outside the program.
Joined: Jun 01, 2005
I don't think object reference will get stored in Heap... If that is going to be stored in Heap ..how it will get garbage collected ..pls explain me ...
about your comment - "how it will get garbage collected", I don't think GC would work that way. In fact it does run on "Heap" by starting from top level objects and then following object graphs to see which objects can be GCed.