Practice mode Java

What is the effect of declaring a Java class final?

Correct answer A. It cannot be subclassed

Explanation

A final class may not appear in another class's extends clause, which is why classes such as String cannot be subclassed. Objects of a final class can be created normally, and its fields are not made constant automatically. Its methods are effectively final because no subclass can exist to override them, but they stay instance methods.

Report a problem

Answer checked How we write and check questions

Tip: press A, B, C or D to answer, and N for the next question.

Advertisement

Have a question about this answer?

Your email address will not be published. Required fields are marked *

Links and website addresses are not allowed in comments.