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 Static Data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Static Data" Watch "Static Data" New topic
Author

Static Data

Raj chiru
Ranch Hand

Joined: Aug 12, 2008
Posts: 141
Q: Where the static data saved in the memory?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Like where physically?
salvin francis
Ranch Hand

Joined: Jan 12, 2009
Posts: 917

1. Java does not allow to use pointers so we can never know for sure the memory location of the saving of a static variable
2. static variables are common to all instances of a class, you can consider them to be "global" (with the proper priveledges)


My Website: [Salvin.in] Cool your mind:[Salvin.in/painting] My Sally:[Salvin.in/sally]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36513
    
  16
Is global quite the right word for a static variable? It really means a variable which is accessible to (and can be used by) any code anywhere in your application. Global variables are popular in C.
Static fields ought to be restricted to within a class (unless they are final in which case they can be read-only global variables).

Heavy dependency on global variables is a problem in programming; it might create code where changes to global variables can cause nasty errors.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Static Data
 
Similar Threads
Member class can have static variables??
String Problem
Static mmbers
locking style
Static Data