Questionsforum
What is difference between final,finalize,finaly?

What is difference between final,finalize,finaly?



On 2014-06-21 01:02:24.0
brajeshkumar


These are the some differences between final, finalize and finaly:

Final :

  • It is used to declare a constant variable.
  • If you want to restrict a method to be overridden you should have to go for this keyword.
  • If you want a class should not has to be extended by other you should have to go final keyword.
  • It is just a keyword to specify the characteristics of a particular variable, class, methods etc.
  • The variable that is declared as final will be resolved at the compile time only.

Finaly :

  • Finaly is a block of code that will give you the guaranty that the code under the finaly block will always be executed even the there is an exception in catch block also.
  • You can use this block of code to close the resources that you have initialized.
  • You you can write a try block without any click. You can use try and finaly.

Finalize :

  • finalize() method is called just before the GC(garbage collector).
  • It is used to close the resources that are still in use and making hindrance in garbage collection.


On 2014-06-25 05:52:12.0
hablu

copyright@questionsforum.net