java - Why does Catch(object o) cause a compile error? -
try { } catch(object o) { }
why leads compile error ? since objects inherit object class.
you can catch objects derive throwable
.
see throwable (java platform), states:
the throwable class superclass of errors , exceptions in java language. objects instances of class (or 1 of subclasses) thrown java virtual machine or can thrown java throw statement. similarly, class or 1 of subclasses can argument type in catch clause.
Comments
Post a Comment