How can you force garbage collection of an object?

  1. Call System.gc()

  2. Garbage collection cannot be forced.

  3. Call System.gc(), passing in a reference to the object to be garbage-collected.

  4. Call Runtime.gc()


Correct Option: B

Find more quizzes: