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:

    “Remember the waterfront shack with the sign FRESH FISH SOLD HERE. Of course it’s fresh, we’re on the ocean. Of course it’s for sale, we’re not giving it away. Of course it’s here, otherwise the sign would be someplace else. The final sign: FISH.”
    —Peggy Noonan (b. 1950)

    “By his very success in inventing labor-saving devices, modern man has manufactured an abyss of boredom that only the privileged classes in earlier civilizations have ever fathomed.”
    —Lewis Mumford (1895–1990)