Memory Allocation in Java
The JVM divided the memory into following sections.
Heap
Stack
Code
Static
This division of memory is required for its effective management.
The code section contains your bytecode.
The Stack section of memory contains methods, local variables, and reference variables.
The Heap section contains Objects (may also contain reference variables).
The Static section contains Static data/methods.
From multiple resources,
Difference between Local and Instance Variable
Instance variable is declared inside a class but not inside a method
Local variable is declared inside a method including method arguments.
From multiple resources,
Memory Allocation in Java The JVM divided the memory into following sections. Heap Stack Code Static This division of memory is required for its effective management. The code section contains your bytecode. The Stack section of memory contains methods, local variables, and reference variables. The Heap section contains Objects (may also contain reference variables). The Static section contains Static data/methods.