How to Write Exception Subclasses ?
Most exception subclasses inherit all their functionality from the superclass. Each subclass majorly serves as a marker for a various types of exception. Therefore it only rarely gives new methods or fields. Thus most of the time the only techniques you required to implement are the constructors. There should be one noargs constructor and one constructor that takes a String message as an argument. These will mostly just invoke the matching superclass constructor.
public class ClockException extends Exception {
public ClockException(String message) {
super(message);
}
public ClockException() {
super();
}
}