Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes When will a variable use memory from stack and when will use memory from heap? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "When will a variable use memory from stack and when will use memory from heap?" Watch "When will a variable use memory from stack and when will use memory from heap?" New topic
Author

When will a variable use memory from stack and when will use memory from heap?

Mr Chan
Greenhorn

Joined: Jun 08, 2002
Posts: 2
When will a variable use memory from stack and use memory from heap?
jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
This question is not based on I/O or streams, would probably be better answered in the beginners forum.
Jack J. Jackson
Greenhorn

Joined: Apr 20, 2002
Posts: 27
Local variables are allocated from stack whereas instance and class variables are allocated as part of object instantiation and consume heap memory.


Jack
 
 
subject: When will a variable use memory from stack and when will use memory from heap?
 
Similar Threads
Pool and Heap's of Confusion
Heap and Stack in memory
difference between stack and heap
When will a variable use memory from stack and when will use memory from heap?
What is Stack memory & heap memory