Final Class in Java

A final class is simply a class that can’t be extended, however that a final class can still extend another non-final class, it is mainly needed for efficiency and security reasons.

As an Example:
If the equals method of a class is defined manually, this class can be considered to be defined as final to prevent being extended by a Subclass. Logically, if this equals method is called by it’s Subclass, the property of equality might not be guaranteed for the Subclass.


Reference (final in java):


About yingding wang
i am looking forward to innovation in IT and Robotics

Comments are closed.

%d bloggers like this: