- Variables which are declared within a Method are referred as a Local variable.
- These variable are allocated memory in the stack.
- These variable are allocated memory once the control enters the Method.
- The memory of these variables are deallocated once the control leaves the method.
- Variables which are declared within the class are referred to as Instance variables.
- They are allocated memory only when an object is created.
- The memory will be allocated in the Heap.
- Deallocation of memory cannot be predicted as it is deallocated by Garbage Collector.