aspose file tools
The moose likes Beginning Java and the fly likes Understanding Static Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Understanding Static" Watch "Understanding Static" New topic
Author

Understanding Static

Yogesh Sharma
Greenhorn

Joined: Mar 17, 2001
Posts: 2
Hi Fellas,
What exactly does "Static" convey? What are the limitations in accessing any variable/method/class designated as "Static"?
Awaiting a dynamic response,
Yogi.
sujeet chatterjee
Greenhorn

Joined: Mar 17, 2001
Posts: 1
Hi
Static methods are universal for JVM and can be implemented without instantiation of classes where the static method was implemented.
Static methods cannot access instance variables as they exist for particular instances.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9033
    
  10
static data belongs to the class, not an individual object of the class. There is exactly one instance of static data, regardless of how many instances of the class there are.

static methods (aka class methods) do class-wide operations and do not apply to an individual object. You can call a static method by prefixing it with the name of an object or the name of the class (preferred)

static block is a block of code prefixed by the keyword static. It must be inside a class and outside all methods. It is executed when the class is first loaded into the JVM.

a static class (aka nested top-level class) is the declaration of an entire class as a static member of another class.

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6913
Strictly there is one instance of a static item for each classloader used to load the class. This doesn't usually matter, but for applications with multiple classloaders (eg. servlet containers, auto-loading test harnesses etc.) this can be a big issue.


A Convergent Visionary ~ Frank's Punchbarrel Blog ~ LinkedIn profile
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Understanding Static
 
Similar Threads
static and non static methods
Static variables?
Class loading
Question
static and non static methods