Search Interview Questions | More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know. |
|
| ||||
Core Java - Interview Questions and Answers for 'Stack memory' - 4 question(s) found - Order By Newest | ||||
| ||||
Ans. 1. Stack Segment - Contains primitives, Class / Interface names and references. 2. Heap Segment - Contains all created objects in runtime, objects only plus their object attributes (instance variables), Static variables are also stored in heap. 3. Code Segment - The segment where the actual compiled Java bytecodes resides when loaded | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   memory   memory management   stack memory   heap memory   code segment memory   advanced Asked in 9 Companies expert   frequent | ||||
Try 6 Question(s) Test | ||||
| ||||
Ans. Local variables are stored in stack whereas object variables are stored in heap. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   jvm   memory management   stack memory   heap memory expert | ||||
| ||||
Ans. member variable are loaded into heap, so they are initialized with default values when an instance of a class is created. In case of local variables, they are stored in stack until they are being used. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   jvm   memory management   variables   stack memory   heap memory   default values expert | ||||
| ||||
Ans. Stack memory areas is used to hold method and local variables while objects are always allocated memory in the heap. The heap memory is shared between multiple threads whereas Stack memory isn't. | ||||
Help us improve. Please let us know the company, where you were asked this question : | ||||
Like Discuss Correct / Improve  java   memory management   stack memory   heap memory   difference between   ebay Asked in 2 Companies intermediate   frequent | ||||
Try 1 Question(s) Test | ||||