Java variable is nothing but a named memory allocation which may vary at the time of execution.A variable assigns a value.
For example, int x=20;
Here x is a variable and the value 20 is assigned to x which is also known as variable initialization.
Basically Java supports three types of variables, such as :
A variable that is declared inside the method is called local variable.
A variable that is declared inside the class but outside the method is called instance variable .
A variable that is declared by the keyword static is called static variable. It cannot be local.