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.

Java Code:
public final class ClassA {

}

public class ClassB extends ClassA  {

}
Error:
Java Code:
The type ClassB cannot subclass the final class ClassA.