Multiple choice

Which of the following commands is used to suggest to do garbage collection explicitly in Java?

  1. System.garbagecollector()

  2. Runtime.garbagecollector()

  3. System.gc()

  4. Runtime.cg()

  5. None of these

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

System.gc() is used to suggest to do garbage collection.