Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Static Varaibles Explination

 
Osgar ali
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I know what static variable, When it comes to it application can someone explain me the circumstances where I can use static variables.
and circumstances where I don't want to use static variables. Any Example will really help.

Regads,
Oskar
 
Dean Pullen
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tbh it's pretty easy to find information on static usage on the web, via Google.

And the Sun Java tutorial: http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html

Static members are class members, not class instance members.
So there's one 'instance' of each static member for any number of class instances.

I think that tutorial page above does a pretty good job of explaining it, and even has a very basic example.
 
Osgar ali
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic