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:

    Sadism and masochism, in Freud’s final formulation, are fusions of Eros and the destructive instincts. Sadism represents a fusion of the erotic instincts and the destructive instincts directed outwards, in which the destructiveness has the character of aggressiveness. Masochism represents the fusion of the erotic instincts and the destructive instincts turned against oneself, the aim of the latter being self-destruction.
    Patrick Mullahy (b. 1912)

    There are three classes into which all the women past seventy that ever I knew were to be divided: 1. That dear old soul; 2. That old woman; 3. That old witch.
    Samuel Taylor Coleridge (1772–1834)