In java adjectives ending in -able are interfaces Serializable
, Comparable
etc... So why is Throwable
a class? Wouldn\'t exception handlin
So why is Throwable a class?
I can think of two reasons:
Wouldn't exception handling be easier if Throwable were an interface?
Exception handling is a hard topic regardless of whether exceptions are classes or interfaces. I actually suspect it would make it harder on Java programmers if they have to order their catch blocks based on arbitrary interfaces rather than on class hierarchies.
But could it be made abstract?
In theory, yes. In practice, no. Too much code depends on being able to create an instance of Throwable in order to call getStackTrace.