Multiple choice technology programming languages

Which of the following statements related to Garbage Collection are correct.

  1. It is possible for a program to free memory at a given time.

  2. Garbage Collection feature of Java ensures that the program never runs out of memory.

  3. It is possible for a program to make an object available for Garbage Collection.

  4. The finalize method of an object is invoked before garbage collection is performed on the object.

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

Programs can suggest garbage collection by removing references (making objects eligible for GC), but cannot force immediate collection (A false). GC does not prevent running out of memory (B false). The finalize() method is called before an object is collected (C and D true).