*
The moose likes Beginning Java and the fly likes can anybody explain memory allocation for static contents? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "can anybody explain memory allocation for static contents?" Watch "can anybody explain memory allocation for static contents?" New topic
Author

can anybody explain memory allocation for static contents?

Bhargavan Marepalli
Greenhorn

Joined: Jun 25, 2011
Posts: 15

can anybody explain memory allocation for static contents?
for example i hav 5 classes and i hav static variable and static methods in all classes..
so memory to those all static wiil be stored at same location and only once..all objects use that memory
My satement is crrect or not??
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Why would you care where that is stored? The only thing you need to know is that static variables are shared by all the instances.


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
James E Baker
Greenhorn

Joined: Jul 28, 2011
Posts: 23
I'm not sure what you're looking for. It will be stored in whatever memory location is available. Just like any variable, you can't predict the specific address of the memory block it will be stored in. The location isn't relative to anything else in your code.

Really, once that class is a part of your program, any memory it allocates is just overhead. It's nothing you need to manage.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can anybody explain memory allocation for static contents?
 
Similar Threads
Memory allocation in Java
Difference between the two statements
exact use of scrictfp in JAVA
wat r legacy classes in JAVA
Output or Compilation error? Surprising!