This is a brief explanation of Variables in Java.
Java has three kinds of variables:
1. local (automatic)
2. Instance
3. Class
Local variables are declared within a method body. Both instance and
class variables are declared inside a class body but outside of any method
bodies. Instance and class variables look similar, except class variables are
prepended with the static modifier.
Again an instance variable occurs once per instance of a class; that is, every
time you create a new instance of the class, the system allocates memory for all
of the class's instance variables. This is in constrast to class variables which
occur once per class regardless of the number of instances created of that
class. The system allocates memory for class variables the first time it
encounters the class.