3 ms·
You _can_ write in Java that very interface you claimed could not be written. interface ThrowingRunnable<E extends Throwable> { void run() throws E;
by sc22 2y ago
You _can_ write in Java that very interface you claimed could not be written.
interface ThrowingRunnable<E extends Throwable> {
void run() throws E;
}
Only, hardly anybody writes it that way, so people forget that it's possible. Why don't people use exception polymorphism in that way? I am not sure, but I believe it would make code too verbose, since every function containing a virtual method call to something that might throw would have to be parameterized that way.