Final Keyword in Java


This Java Tutorial is all about Final Keyword in Java.
Final keyword in Java can be used with class, object, method and variables. It is used in order to restrict the user.

If final keyword is used along with the class, then that class cannot be extended.

If final keyword is prefixed before method then we will not be able to override that method.

If final keyword is used before variable/ object then we will not be able to reinitialize that object or variable.


Syntax for using final keyword.

public final class A{



public final void method1 {


final int temp;



If a user is trying to violate any rule, user will get compile time error.

Facebook Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.