Global Variable - Java: No Explicit Globals

Java: No Explicit Globals

Some languages, like Java, don't have global variables. In Java, all variables that are not local variables are fields of a class. Hence all variables are in the scope of either a class or a method. In Java, static fields (aka class variables) exist independently of any instances of the class and one copy is shared among all instances; hence static fields are used for many of the same purposes as global variables in other languages because of their similar "sharing" behavior.

Read more about this topic:  Global Variable

Famous quotes containing the word explicit:

    I think “taste” is a social concept and not an artistic one. I’m willing to show good taste, if I can, in somebody else’s living room, but our reading life is too short for a writer to be in any way polite. Since his words enter into another’s brain in silence and intimacy, he should be as honest and explicit as we are with ourselves.
    John Updike (b. 1932)