A variable holds data. It has a name, a type, and a value. Java's use of local variables is essentially the same as C, except that variable definitions don't have to all come at the start of a method. A variable can be defined in the middle of a function, and can then be used in subsequent statements up to the end of the block in which it was created.
Variables can also be fields in a class.
The field variables of a class can be referenced by simple, unqualified names within any of the method functions of the class. Field variables are classified as static or instance variables. A field variable declared with the keyword static is allocated storage within the class itself. It is initialized when the class is loaded. It acts as a global variable shared by all the methods of the class, and if it is declared public it is shared by all parts of the program.