My Hindi Forum

My Hindi Forum (http://myhindiforum.com/index.php)
-   Tech Talks (http://myhindiforum.com/forumdisplay.php?f=20)
-   -   difference between final, finally and finalize (http://myhindiforum.com/showthread.php?t=61)

javaguru 22-12-2009 08:18 PM

difference between final, finally and finalize
 
What is the difference between final, finally and finalize?

javaguru 22-12-2009 08:19 PM

Quote:

Originally Posted by javaguru (Post 124)
What is the difference between final, finally and finalize?

final - declare constant
finally - handles exception
finalize - helps in garbage collection

Variables defined in an interface are implicitly final. A final class can’t be extended i.e., final class may not be subclassed. This is done for security reasons with basic classes like String and Integer. It also allows the compiler to make some optimizations, and makes thread safety a little easier to achieve. A final method can’t be overridden when its class is inherited. You can’t change value of a final variable (is a constant). finalize() method is used just before an object is destroyed and garbage collected. finally, a key word used in exception handling and will be executed whether or not an exception is thrown. For example, closing of open connections is done in the finally method.


All times are GMT +5. The time now is 01:37 AM.

Powered by: vBulletin
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
MyHindiForum.com is not responsible for the views and opinion of the posters. The posters and only posters shall be liable for any copyright infringement.