Sometimes you don't want your class to be subclassed. Which means, other classes should not inherit from it. In that case, you have to use final keyword with your class.
public final class ClassA {
}
public class ClassB extends ClassA {
}
Error:
The type ClassB cannot subclass the final class ClassA.