variable in Java

Java doesn't technically support global variables. As a pure (almost? still have primitive like int) object-oriented language, everything needs to be part of a class. The reason is to protect data and members of classes from being changed, inadvertently or on purpose, by other parts of the program. However, you still may need to have variables that can be accessed across your program, and not confined to specific classes. We can create public static variables that are more accessible. 
The rules and conventions for naming Java variables can be summarized as follows:
* Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "\_". The convention, however, is to always begin your variable names with a letter, not "$" or "\_". Additionally, the dollar sign character, by convention, is never used at all. 
* Subsequent characters may be letters, digits, dollar signs, or underscore characters. Conventions (and common sense) apply to this rule as well. Also keep in mind that the name you choose must not be a keyword or reserved word.
* If the name you choose consists of only one word, spell that word in all lowercase letters. If it consists of more than one word, capitalize the first letter of each subsequent word.