File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: When will a variable use memory from stack and when will use memory from heap?