Which of the following statement(s) is/are correct regarding JAVA programming?…
2021
Which of the following statement(s) is/are correct regarding JAVA programming? I. A class marked as final cannot be inherited. II. A method marked final cannot be overridden.
- A.
Only I
- B.
Only II
- C.
Both I and II
- D.
Neither I nor II
Attempted by 139 students.
Show answer & explanation
Correct answer: C
In Java, a class declared as final cannot be subclassed, making Statement I correct. Similarly, a method marked final prevents overriding in subclasses, validating Statement II as well. Therefore, both statements accurately describe the behavior of the final keyword.