Java – Final – MCQ

In Java, the final keyword is used to define constants, prevent method overriding, and prevent inheritance. When applied to a variable, it makes the value unmodifiable after initialization. For methods, it ensures they cannot be overridden in subclasses, and for classes, it prevents further subclassing. This keyword promotes immutability and ensures program stability by enforcing these restrictions.

Loading...