Final (Java) - Final Classes

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 {...} // forbidden

Restricted 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 final key to the way I promote is bravado. I play to people’s fantasies. People may not always think big themselves, but they can still get very excited by those who do. That’s why a little hyperbole never hurts.
    Donald Trump (b. 1946)

    Of all reformers Mr. Sentiment is the most powerful. It is incredible the number of evil practices he has put down: it is to be feared he will soon lack subjects, and that when he has made the working classes comfortable, and got bitter beer into proper-sized pint bottles, there will be nothing left for him to do.
    Anthony Trollope (1815–1882)