posted 11 years ago
finalize() is a method from java Object class, when there are no active references to an object "finalize" method will be called by Garbage Collector,
finalize method can be called once on any given object ( by JVM )
finally block
this block can be used to write code, that you want to execute in any case ( meaning irrespective of whether the try block throws some exception or not - the statements in finally block will be always executed unless and until there is a preceding System.exit() call in code)
in the coding scenarios that i have seen, this block is used release all the open connections and resources
just a prototype :
finally
{
if(Connection != null)
connection = null
if(Resultset != null )
Resultset = null
}
Regards
Rahul Parakkat