wood burning stoves 2.0*
The moose likes Java in General and the fly likes Java Heap and Stack Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java Heap and Stack" Watch "Java Heap and Stack" New topic
Author

Java Heap and Stack

Girish Prabhudesai
Greenhorn

Joined: Nov 11, 2002
Posts: 5
Can anybody tell me difference in memory stack and heap being used in Java JVM?
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24183
    
  34

Basically, the stack is where local variables are kept -- ints, floats, doubles, and references to objects -- while the heap is where objects themselves are allocated. So variables on the stack can point to objects on the heap.
Does this answer your question?


[Jess in Action][AskingGoodQuestions]
Girish Prabhudesai
Greenhorn

Joined: Nov 11, 2002
Posts: 5
Thanks for the answer.
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
All Objects are stored on Heap.
All variables and address of object inHeap are stored in Stack.
VIJAY Yadlapati
Ranch Hand

Joined: Aug 04, 2003
Posts: 175
All Objects are stored on Heap.
all variables and addresses of objects are stored on Stack.
 
wood burning stoves
 
subject: Java Heap and Stack
 
Similar Threads
Where do static variables (class variables) live (scope)?
Static
Stack and Heap
heap and stack?
string construction