what is heap and stack java interview question and answer

what is heap and stack java interview question and answer

Interview DOT

1 десятилетие назад

26,913 Просмотров

Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications. JOB VACANCIES IN TOP IT / NOT-IT COMPANIES

UPLOAD YOUR RESUME IN 1 MINUTE ! ! !
http://www.interviewdot.com/upload-resume/uploadresume.htm

http://www.InterviewDot.com

Welcome to www.InterviewDot.com How to for prepare for Java Interview Questions :

Explain "Java Memory Model" ? : Java Interview Questions and Answers.


Java Memory Model :
Heap
Stack
JVM Stack
Native method stack
Method Area
Runtime constant pool
Method code




Heap :
It is used to store the class instances [objects] and arrays, To reclaim the memory occupied by the unused object JVM uses it's own Garbage Collector, which runs as a daemon thread by JVM and reclaims unused objects from the heap memory.


For more Java Interview questions and answers - logon to www.InterviewDot.com - India's Top Interview Guide.

Welcome to www.InterviewDot.com How to for prepare for Java Interview Questions :

Explain "Java Memory Model" ? : Java Interview Questions and Answers.

Method Area :
The method area stores class structure. That includes methods, constructors, constants and static fields. This can be garbage collected sometimes. If a class becomes unreferenced by application, then JVM will unload this class by using Garbage collection.

Stack :
For each thread a stack will be allocated, Thread adds one frame for every method execution. Every frame stores local variables, intermediate calculations of a method execution, method parameters and return value. Once the thread execution completes, the respective frame will be removed from stack.

Frames:
A frame is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions.

A new frame is created each time a method is invoked.

A frame is destroyed when its method invocation completes, whether that completion is normal or abrupt.

For more Java Interview questions and answers - logon to www.InterviewDot.com - India's Top Interview Guide.

http://www.InterviewDot.com http://www.InterviewDot.com http://www.InterviewDot.com

Тэги:

#what #is #heap #and #stack #java #interview #question #answer
Ссылки и html тэги не поддерживаются


Комментарии: