global variable

Global variables are defined outside of all the functions and classes, usually on top of the program. A global variable can be accessed by any function or any class.
* Global variables hold their value throughout the lifetime of your program. 
* Global variables are created before the main functions starts.
* Global variables are in general best avoided because they cause maintenance problems. If you must use global variables, at least restrict their use to a single source file.

Global variables are not technically allowed in Java. A global variable is one declared at the start of the code and is accessible to all parts of the program. Since Java is object-oriented, everything is part of a class, so there is no global variable in Java.