Skip to content
Sharp

Engineering Interviews · interview question

What method in Java is responsible for suggesting to the JVM that garbage collection might be necessary?

Multiple choiceEasychapter-20-curatedpremiumengineering-interviewsjvm-trivia
Choose one answer
Answer and explanation

Correct answer

D. System.gc()

Why

System.gc() is a method that suggests to the JVM that garbage collection should be considered. However, calling this method does not guarantee that garbage collection will occur immediately.

Test yourself on Engineering Interviews

A free test with instant, explained results. No account needed.

Start free test
All Engineering Interviews questions →