Based on type of value represented by a variable,
Two types of variables:
1. Primitive variables : Used to hold primitive values.
Ex: int a = 100;
2. Reference variables : Used to hold Objects.
Ex: A a = new new A();
a -> reference
Based on Purpose and position of declaration of variable,
Three types of variables:
1. Local variables : These variables are declared inside a method or block.
2. Static variables : Value of a variable does not varies from object to object.
3. Instance variables : Value of a variable varies from object to object. These are created at the time of Object creation and these are saved in heap area.