Answer options: Assume that garbage collection runs and all elligible objects are collected and finalized. A It does not compile due to incorrect signature of the finalize method. B It compiles but no text is written when it runs due to incorrect signature of the finalize method. C Before "exiting" is written, 2 messages from finalize will be printed. D Before "exiting" is written, 3 messages from finalize will be printed
Which one would be the answer? (code tag fixed and missing }s added ) [ November 09, 2004: Message edited by: Barry Gaunt ]
I think the answer should be option C. There are two objects which are eligible for garbage collection. They are the ones which are generated when i=0; and i=1; the object created when i=2; has reference t and obj.
Hope that helps you. [ November 08, 2004: Message edited by: Jay Pawar ]
Cheers,<br />Jay<br /> <br />(SCJP 1.4)<br />Heights of great men were not achieved in one day, they were toiling day and night while their companions slept.
I think none of the answers are correct. Even with the assumption that the garbage collector is run, the 2 messages could be printed before or after the "exiting".