Object Oriented Software Engineering   View all facts   Glossary   Help
subject > programming language construct > data item > variable > Java variable
Next variablereference    Upvariable    Previous variableinstance variable   

Java variable comparison table
Subject serve as have be implement overuse declared have purpose access by declared in mark as share by
Java class variablea global variablea value that is shared by all instances of a classas private as possible   storing:
  • Default or 'constant' values that are widely used by methods in a class
  • Lookup tables and similar structures used by algorithms inside a particular class
specifying the name of the class, followed by a dot, followed by the name of the variablethe body of the class (not inside a method)staticall instances of the class
Java instance variable an interface as its type which means that, with the variable, you can invoke any operation supported by the interfaceas private as reasonably possible - almost never make them publican attribute or association private other variables and methods in any class in the same package by default   

Next variablereference    Upvariable    Previous variableinstance variable