• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

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

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Viswanathan Nachiappan:
Also Can any one tell where the Static primitive variables are stored???



Its also in heap
 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
I found some pretty shells, some sea glass and this lovely tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic