The Java calls finalize( ) method whenever it is about to recycle an object.
finalize() is called just prior to garbage collection.
The finalize( ) method has this general form:
protected void finalize( )
{
// finalization code here
}
The keyword protected prevents access to finalize( ) by code defined outside its class.