Question
Question: Which of the following statements regarding Java's memory management and garbage collection is true? A) Java's garbage collector automatically frees memory occupied by objects
Question: Which of the following statements regarding Java's memory management and garbage collection is true?
A) Java's garbage collector automatically frees memory occupied by objects that are no longer reachable, but it does not reclaim memory occupied by unreachable static fields.
B) The finalize() method can be overridden to perform cleanup actions before an object is garbage collected, ensuring that important resources are released.
C) The Java Virtual Machine (JVM) uses a reference counting mechanism for garbage collection, making it impossible for circular references to lead to memory leaks.
D) The WeakReference class allows the garbage collector to reclaim memory from objects even if they are still referenced, provided that there are no strong references to them.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
The detailed answer for the above question is provided below The correct statement is A Javas garbage collector automatically frees memory occupied by ...Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started