Final Classes
A final class cannot be subclassed. This is done for reasons of security and efficiency. Accordingly, many of the Java standard library classes are final, for example java.lang.System
and java.lang.String
. All methods in a final class are implicitly final.
Example:
public final class MyFinalClass {...} public class ThisIsWrong extends MyFinalClass {...} // forbiddenRestricted subclasses are often referred to as "soft final" classes.
Read more about this topic: Final (Java)
Famous quotes containing the words final and/or classes:
“The kind of power mothers have is enormous. Take the skyline of Istanbulenormous breasts, pathetic little willies, a final revenge on Islam. I was so scared I had to crouch in the bottom of the boat when I saw it.”
—Angela Carter (19401992)
“There are four classes of idols which beset mens minds. To these for distinctions sake I have assigned namescalling the first class Idols of the Tribe; the second, Idols of the Cave; the third, Idols of the Market-Place; the fourth, Idols of the Theatre.”
—Francis Bacon (15611626)