static

A static variable is initialized when a class is loaded, what it means
[77 byte] By [b.m.krajua] at [2007-11-27 0:40:09]
# 1
That the value is set when the class is loaded.
kajbja at 2007-7-11 22:52:49 > top of Java-index,Java Essentials,Java Programming...
# 2
class is loaded from where to where it is loaded
b.m.krajua at 2007-7-11 22:52:49 > top of Java-index,Java Essentials,Java Programming...
# 3

Hey here is a great help

A static variable is intilized when the class is loded. Which means that

the static variable will have the same value regardless of the number of

objects we create from that class. And the value of that static variable is the same in all objects of that class.

Example let say there is a static variable x in class animal

lets say we create an object called cat from the class animal and also an object dog.

the value of the vairable x is the same in both cat and dog always.

if we make

cat.x=9

then the x in dog will also be 9.

Hence, static variables can be used to share a common information

between objects of the same class. For example the number of legs is

common to both cats and dogs

bisrta at 2007-7-11 22:52:49 > top of Java-index,Java Essentials,Java Programming...
# 4

> the value of the vairable x is the same in both cat

> and dog always.

> if we make

>cat.x=9

> dog will also be 9.

And the whole point is: static variables are not related to class's objects, and they are not supposed to be accessed through an object reference.

CeciNEstPasUnProgrammeura at 2007-7-11 22:52:49 > top of Java-index,Java Essentials,Java Programming...