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:
http://stackoverflow.com/questions/5181578/use-of-final-class-in-java

Reference (final in java):
http://javarevisited.blogspot.de/2011/12/final-variable-method-class-java.html

Advertisements

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

Comments are closed.

%d bloggers like this: