0 votes
in JAVA by
Which option is false about the final keyword?

i) A final method cannot be overridden in its subclasses.

ii) A final class cannot be extended.

iii) A final class cannot extend other classes.

iv) A final method can be inherited.

1 Answer

0 votes
by

(iii) A final class cannot extend other classes.

Reason: The final is a reserved keyword in Java that is used to make a variable, method, and class immutable. The important features of the final keyword are:

  • Using the final keyword with a variable makes it constant or immutable. We can't reassign the values of it.
  • A final variable must be a local variable and cannot be used in other classes.
  • Using the final keyword with a method makes it constant, and we can't override it in the subclass.
  • Using final with a class makes the class constant, and we cannot extend a final class. But a final class can extend other classes.

Related questions

0 votes
asked Apr 8, 2021 in JAVA by SakshiSharma
0 votes
asked Apr 9, 2021 in JAVA by Robindeniel
...