How can you force an object to be garbage collected? : Questions « Java Source And Data Type « SCJP






A. Invoke its finalize() method.
B. Remove all references to the object.
C. Use all memory that is available to the program.
D. You cannot force an object to be garbage collected.








1.32.Questions
1.32.1.Importing has no effect on class loading or on any other run-time function(True/False).
1.32.2.Answer: Importing and run-time
1.32.3.Which of the following are legal import statements?
1.32.4.Answer: import declaration
1.32.5.Which of the following may be statically imported?
1.32.6.Answer: static import
1.32.7.What is printed output?
1.32.8.Answer: static string value
1.32.9.What is the output for string s?
1.32.10.Answer: string value output
1.32.11.Which of the following are legal(int type variable declaration)?
1.32.12.Answer: int type variable declaration
1.32.13.Which of the following are valid Java comments?
1.32.14.Answer: create comments
1.32.15.When is v1 object in line 4 first subject to garbage collection?
1.32.16.Answer: ready for garbage collection
1.32.17.At which line is the Vector object, created in line 4, first subject to garbage collection?
1.32.18.Answer: time for garbage collection
1.32.19.How can you force an object to be garbage collected?
1.32.20.Answer: forcing garbage collection
1.32.21.The object became unreachable, if it has been garbage collected(True/False).
1.32.22.Answer: object garbage collection
1.32.23.If an object with a finalize() method has been garbage collected, its finalize() method was invoked by the garbage collector(True/False).
1.32.24.Answer: finalize() and garbage collection
1.32.25.If an object has been garbage collected, its memory is subject to reuse(True/False).
1.32.26.Answer: garbage collection and memory reuse
1.32.27.An unreachable object will be garbage collected(True/False).
1.32.28.Answer: unreachable object and garbage collection
1.32.29.The finalize() method of an unreachable object will be invoked.
1.32.30.Answer: finalize and unreachable
1.32.31.An unreachable object can become reachable again.
1.32.32.Answer: unreachable and reachable
1.32.33.Java garbage collector guarantees that Java programs will never run out of memory(True/False).
1.32.34.Answer: garbage collection and out of memory