Multiple choice

Which of the following is used to explicitly call the garbage collector in Java?

  1. System.gc()

  2. System.garbage();

  3. System.gcollector()

  4. System.memoryfree();

  5. None of these

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

System.gc() kindly asks the sytem to perform a garbage collection. Javadoc says:Runs the garbage collector