Where objects, methods and variables are stored in memory in Java?

Java Programming Java8Object Oriented Programming

There are five main memory areas which are used to various Java elements. Following is the list of the same.

  • Class Area - This area contains the static members of the class.

  • Method Area - This area contains the method definition and executable code.

  • Heap Area - This area contains the objects which are dynamically allocated/deallocated. if an object is no more referenced by any live reference it is deallocated.

  • Stack Area - This area contains the local variables.

  • Pool Area - Contains immutable objects like string.

raja
Published on 19-Sep-2018 15:04:30
Advertisements