- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Difference Between Final, Finally and Finalize in Java
In this post, we will understand the difference between ‘Final’, ‘Finally’, and ‘Finalize’ in Java.
Final
It is a keyword.
It is used to apply restrictions on classes, methods and variables.
It can’t be inherited.
It can’t be overridden.
Final methods can’t be inherited by any class.
It is needed to initialize the final variable when it is being declared.
Its value, once declared, can’t be changed or re-initialized.
Finally
It is a block.
It is used to place important code in this block.
It gets executed irrespective of whether the exception is handled or not.
Finalize
It is a method.
It is used to perform clean up processing right before the object is collected by garbage collector.
Advertisements