Question:

What is the use of the final keyword in Java?

Show Hint

final locks things. Which option describes something being locked, not allowed?
Updated On: Jul 2, 2026
  • To indicate that a class can be inherited
  • To define an abstract method
  • To indicate that a variable can be modified
  • To indicate that a method cannot be overridden
Show Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Step 1: In Java, the final keyword restricts change. Its effect depends on where it is applied.

Step 2: A final variable cannot be reassigned once set. A final class cannot be extended. A final method cannot be overridden by a subclass.

Step 3: Check the options. A final class cannot be inherited, so (A) is wrong. final is not used to define abstract methods, so (B) is wrong. A final variable cannot be modified, so (C) is wrong.

Step 4: The correct valid use listed is (D), a final method cannot be overridden.
Was this answer helpful?
0
0