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:
“Resolved, There can never be a true peace in this Republic until the civil and political rights of all citizens of African descent and all women are practically established. Resolved, that the women of the Revolution were not wanting in heroism and self-sacrifice, and we, their daughters, are ready, in this War, to pledge our time, our means, our talents, and our lives, if need be, to secure the final and complete consecration of America to freedom.”
—Womans Loyal League (founded May 1861)
“I have no doubt but that the misery of the lower classes will be found to abate whenever the Government assumes a freer aspect and the laws favor a subdivision of Property.”
—James Madison (17511836)