What is Variable and Types of variable in Java ?

Variable : is name of reserved area allocated in memory. for ex. int data=50; // here data is variable

Types of Variable :

  1. Local variable
  2. Instance variable
  3. Static variable

Local variable : declared inside the method .

Instance variable : declared inside the class but outside the method.

Static variable : declared as static and it can’t be local.

Leave a Reply