yattias
asked on
static
Can anyone tell me what exactly Static means and when it should be used. I kinda know when to use it but I am not sure I quite get the concept of it.
thanks
thanks
ASKER
I am not so sure I fully understand your definition of static. Could you be more specific?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Basically its a member of the class for instantiating or using which you don't need to create objects of the class.
Explained here: http://www.mindprod.com/jgloss/static.html
Explained here: http://www.mindprod.com/jgloss/static.html
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes, you can use them for utilities (where you would expect the same result from a method and you don't need any instance data-members), and static is also made use of in the singleton design pattern.
accessing static variables for a method.
to be executed at startup for a block {}
Example: static int count = 0; // to count objects of this kind, 0 == no objects, still a variable,
static void counter() { ++ count; } // to access this variable.
;JOOP!