Practice mode Java

What is guaranteed when a Java program calls System.gc()?

Correct answer A. Only that it suggests the JVM should try to reclaim memory

Explanation

The documentation describes System.gc as suggesting that the JVM expend effort to recycle unused objects, and an implementation is free to do very little. No object is promised to be freed and no timing is guaranteed. Correct programs should not depend on it, and the JVM can even be configured to ignore explicit calls.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.