View RSS Feed

Java Basic

Final, finally and finalize

Rate this Entry
by , 01-08-2012 at 11:38 AM (2706 Views)
• final – It’s a constant declaration.

• finally – It handles exception. It is an optional block to write at the end of your exception handling block. It is usually used to close files, close database connections and statements. Also release all other resources in this block.

• finalize – This method is called by the garbage collector. Garbage collector always called this method before it performs garbage collection on that object. It should not be used to release non memory resources such as file handlers, database connections etc. Because you do not know when this garbage collector will start it execution and collect all those resources. Garbage collection is a low priority thread.

Submit "Final, finally and finalize" to Facebook Submit "Final, finally and finalize" to Digg Submit "Final, finally and finalize" to del.icio.us Submit "Final, finally and finalize" to StumbleUpon Submit "Final, finally and finalize" to Google

Categories
Access Modifier

Comments