Final class modifier - locking a class

A class can be prefixed with the final non-access modifier to prevent the class from being inherited by another class:

    public final class ThisClassCanNotBeOverriden {
}

The final keyword can be added before or after a class's access modifier, if present. By convention the access modifier is specified first, followed by non-access modifiers. If another class tries to inherit a final class, the compiler will refuse to compile the code.