Final is keyword | Finalize is method | Finally is a block
Final:
- Final is non-access modifier applicable to variable, method or a class only
- Final class à this class cannot be extended (means no child class possible)
- Final methods à final methods cannot be overridden in child class.
- Final variable à they become constant and no re-assignment of variable possible
Finalize() :
- This method in present in Object class
- This is called by Garbage Collector for clean-up activities before destroying an object.
Finally:
- Is block for handling important statements like closing Database connections or closing file
- This is executed whether exception occurs or not (Remember in try-catch-finally)
Post a Comment