What is deference between final, finally, finalize key words?

Ans

Final:

Final is a modifier that applicable for classes, methods and variables. If a class declared as final we can’t extends that class. i.e we can’t create child for that class.

If a method declares as final then we can’t override that method in child class. If a variable declare as final it will become constant and we can’t perform reassignment for that variable.

Finally:

Finally block is always associated with try catch to maintain cleanup code.

Try
{
// risky code
}
Catch(X e)
{
Handle code
}
Finally
{
// cleanup code
}

Finalize:

Finalize () is a method which is always invoked by garbage collector just before destroying object to perform cleanup activities.

Note:

Finally ment for cleanup activates related to try block, where as finalize () method ment for cleanup activities related to objects.