Return to site

JAVA CERTIFICATION QUESTION: The effects of declaring a Java class as final

=>When the final modifier is applied to a class, the modifier prevents that class from being subclassed. When is this a benefit?

· java,ocp

Which of the following is a benefit of declaring a Java class as final? Choose one.

A. It promotes the principle “prefer inheritance over composition.”

B. It simplifies class unit testing.

C. It helps to design immutable classes.

D. It prevents instantiation of the class.





·ꓛ puɐ ꓭ suoᴉʇdo ǝɹɐ sɹǝʍsuɐ ʇɔǝɹɹoɔ ǝɥꓕ ·uoᴉsnʅɔuoꓛ

All Posts

Almost done…

We just sent you an email. Please click the link in the email to confirm your subscription!