Share via


final

The final keyword is used as a modifier for classes, methods, and variables.

When the final keyword appears in a class declaration, it means that the class may never be subclassed or overridden. This prevents over-specialization of a particular class. In some sense, the person who created the class considered any further changes to be tangential to its primary purpose.

When the final keyword appears in a method declaration, it means that the method may never be overridden. (Note that methods declared with the keywords static or private are implicitly final.)

When the final keyword appears in a variable declaration, it means that the variable has an assigned value that can never be changed.