This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
The general contract of finalize is that it is invoked if and when the JavaTM virtual machine has determined that there is no longer any means by which this object can be accessed by any thread that has not yet died, except as a result of an action taken by the finalization of some other object or class which is ready to be finalized.
I have not got this point : except as a result of an action taken by the finalization of some other object or class which is ready to be finalized
What would this exception be? Could you make a real life code example?
even this following bit of the same method description is not very clear:
For example, the finalize method for an object that represents an input/output connection might perform explicit I/O transactions to break the connection before the object is permanently discarded.
last but not least:
Any exception thrown by the finalize method causes the finalization of this object to be halted, but is otherwise ignored.
Does it halt the process or ignore the exception?
to break the connection? the connection should be closed with close()..