File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Re: Storage of objects and values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Re: Storage of objects and values" Watch "Re: Storage of objects and values" New topic

Re: Storage of objects and values

veeramani velayutham

Joined: Dec 10, 2004
Posts: 11
how objects and values are stored in java. i.e heap or stack.

can anyone explain the process how its stored.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
In general, member variables are on the heap, parameters and local variables in a method are on the stack. I almost never think about heap and stack (unless I do recursion wrong and blow up the stack.) I do think about scope ... does this information need to live beyond the method?

I recently read some quotes from one of the creators of Simula, a direct precursor to object oriented thinking. They just moved some data from the stack to the heap. They didn't think it was any big revolution, just a convenient place to store stuff they'd need again later.

Here's the first in a neat series getting Under The Hood of the JVM. It's a nice introduction to all kinds of JVM internals, even if it's a couple releases old now.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
It is sorta covered in the JavaRanch Style Guide.
subject: Re: Storage of objects and values
jQuery in Action, 3rd edition