Written by the Fiveable Content Team โข Last updated September 2025
Verified for the 2026 exam
Verified for the 2026 examโขWritten by the Fiveable Content Team โข Last updated September 2025
Definition
The final keyword is used in Java to declare constants, make methods unchangeable (cannot be overridden), and prevent inheritance (a final class cannot be extended). Once assigned or declared as final, their values or definitions cannot be changed.
Related terms
Constant Variable: A constant variable is declared using the final keyword and represents fixed values that cannot be modified during program execution. They are typically used for storing values that should not change throughout the program.
Immutable Object: An immutable object is an object whose state cannot be modified after it is created. The final keyword is often used to create immutable objects by making their fields private and final, and not providing any setter methods.
Final Method: A final method is a method that cannot be overridden by subclasses. Once a method is declared as final in the superclass, it cannot be modified or overridden in any of its subclasses.