In Java, There are three types of variabes, These are:
1) Local VariableA variable, which is declared inside any methods, constructors, and blocks is known as a local variable.Its scope is limited because it is used locally in the method. It is created after the creation of the method,constructor, block, a local variable is not visible to class and not accessed by the class.
2) Static VariableA static variable is a very important type of variable. We use static keyword with the variable. Hence, it’s called as a static variable.Static Variable is declared inside the class and outside the method, constructor and a block. Static variable belongs to the class, not an Object and it is stored in static memory. Its defaultvalue is 0 and we can call the static variable with its class name.
3) Instance Variable
An instance variable is declared inside the class but outside the method, constructor or block. It has the widest scope because it is globally visible to the whole class. It is created at the time ofobject creation. When instance variable is created at that time, it takes space in the heap memory and it is called through the object and the default value is 0.
For a detailed tutorial and example program on Variables in Java, Visithttps://www.c-sharpcorner.com/article/a-complete-java-classes-tutorial/