Ning2018 / JavaFundamentals

0 stars 0 forks source link

Stack and heap #4

Open Ning2018 opened 6 years ago

Ning2018 commented 6 years ago

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.

Ning2018 commented 6 years ago

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.