Site icon TestingDocs.com

Java Heap vs Stack

Heap vs Stack

Whenever a class is executed by specifying its corresponding class name by using the command “java {classname}” the java launcher JAVA immediately initiates the java run-time environment for the class execution as a layer on top of the operating system.

Java Heap

Java Stack

Stack Frame is a sub-block inside a thread created to execute a method or block and is destroyed automatically after the completion of the method. If the method has any local variable they all are created inside the method’s stack frame and are destroyed automatically when the stackframe is destroyed. Stack Frame is divided into 3 blocks:

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version