Hi, I am little bit confused about this question. Please Help me.
A. You can directly free the memory allocated by an object. B. You can directly run the garbage collector whenever you want to. C. The garbage collector informs your object when it is about to be garbage collected. D. The garbage collector reclaims your object's memory as soon as it becomes a candidate for garbage collection. E. The garbage collector runs in low-memory situations.
My choices are : A.false B.false C.false D.false E.true Correct me if I am wrong. Thanking you Rosemol.
Rajiv Ranjan
Ranch Hand
Joined: Sep 28, 2000
Posts: 61
posted
0
I think only valid choice is c.
Rosemol Thanjappan
Ranch Hand
Joined: Aug 08, 2000
Posts: 40
posted
0
Hi ,
Originally posted by Rajiv Ranjan: I think only valid choice is c.
Option C. The garbage collector informs your object when it is about to be garbage collected. How is garbage Collector informs ?
Thanking you Rosemol.
Sam Zheng
Ranch Hand
Joined: Nov 29, 2000
Posts: 61
posted
0
By calling the finalize() method of the object.
Vijayakumar Ramakrishnan
Greenhorn
Joined: Dec 16, 2000
Posts: 24
posted
0
I go for C,E. C is done by giving a call the protected void finalize() throws Throwable method of the Object. E is true coz gc is a low priority thread. Vandanam, Vijay
Ashish Agarwal
Ranch Hand
Joined: Dec 02, 2000
Posts: 36
posted
0
The only correct answer is c. Before collecting object's memoty gc invokes finalize(). Low priority thread does not mean that gc will run in low memory situations. You can never predict when gc is going to run, not even System.gc() ensures that. Ashish
Rosemol Thanjappan
Ranch Hand
Joined: Aug 08, 2000
Posts: 40
posted
0
Thank you all, Now I chose only Option C. Since low priority does not means low memory and Garbage Colletion cannot be predicted Thanking you all Rosemol.