The final, finally, and finalize are one of the three confusing keywords, modifiers and methods in Java. They sounds similar but they are for different purpose. For example, final keyword is a modifier in Java. When you use final keyword with a class it becomes a final class and no one can extend this e.g. String is final in Java. When you use the final modifier with method than it cannot be overridden in subclass, and when you use the final keyword with variable, it become a constant i.e. its value cannot be changed once assigned. On the other hand, finally is a keyword related to exception handling in Java. It's often used with try block and it's part of try, catch and finally trio. A finally block can be used with or without catch block in Java and its guaranteed to be always executed, irrespective of what happens inside try block. This is the reason finally block is used to do cleanup and free resources.
Read more »
