3 ms·
Java has a lot of "throwingness polymorphism". You can extend an interface to say a method throws a subclass of the Exception thrown by the parent interface met
by EricRiese 3y ago
Java has a lot of "throwingness polymorphism". You can extend an interface to say a method throws a subclass of the Exception thrown by the parent interface method. You can extend an interface and say that that method actually doesn't throw an exception at all.
interface NonThrowingAutoCloseable extends AutoCloseable {
void close();
}
You can also declare that you throw a generic exception type
interface ThrowingSupplier<E extends Exception> {
void get() throws E;
}