aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Where are these java  ...... etc stored Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Where are these java  ...... etc stored" Watch "Where are these java  ...... etc stored" New topic
Author

Where are these java ...... etc stored

Mohan Ramanna
Ranch Hand

Joined: Jun 26, 2000
Posts: 36
I have read that java objects are stored on the Heap in
the memory can i get a list of reference where
java objects, variables,static,final variables etc, primitive
objects are stored.
A detailed explanation of the above is expected?
Thanks in advance
- MOhan
Viswanathan Nachiappan
Greenhorn

Joined: Jul 26, 2006
Posts: 5
Method primitive variables are stored in the Stack.

Static Objects will be stored in the Heap, but where will there reference be stored?

Also Can any one tell where the Static primitive variables are stored???

Thanks in Advance,
viswa
vidya sagar
Ranch Hand

Joined: Mar 02, 2005
Posts: 580
Originally posted by Viswanathan Nachiappan:
Also Can any one tell where the Static primitive variables are stored???


Its also in heap
Douglas Chorpita
Ranch Hand

Joined: May 09, 2006
Posts: 97
Local variables (primitives and references) are stored on the stack. The stack is a data structure that allows for recursion (when a method calls itself). Local variables need to be created for each level of invokation. So a stack is used.

Pretty much everything else is stored on the heap, which allocates memory for objects and arrays (which are objects).

There is also a String literal pool, which stores String objects (which contain references and integers). The string's char[] array is actually also stored on the heap.

In C++, you can put objects on the stack, which generally results in better performance. This can be dangerous though, as too many objects on the stack can lead to stack overflow, which is fatal. A stack overflow in Java is also possible, if a method calls itself over and over again without stopping.
[ July 27, 2006: Message edited by: Douglas Chorpita ]

SCJP 1.4 - 95%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Where are these java ...... etc stored
 
Similar Threads
static variables
where variable and objects are stored
confusion in heap and stack - PLEASE HELP
Declaration difference
What is stored on Stack and Heap