Create a dedicated catch clause for each exception that is declared in the throws clause.
public static class Loader {
public void load() throws UnsupportedOperationException, ClassNotFoundException {}
}
public static void main(String[] args) {
Loader loader = new Loader();
try {
loader.load();
} catch ( UnsupportedOperationException e1 ) {
System.out.println( "load is not implemented" );
} catch ( ClassNotFoundException e2 ) {
System.out.println( "No class " + e2.getMessage() );
}
}
|
|