- Erweitern Sie 'java.lang.Exception'.
- Ändern Sie die throws-Klausel so, dass diese neue Ausnahmebedingung verwendet wird.
public static class ExceptionSubclass extends Exception {
public ExceptionSubclass( String s ){
super(s);
}
}
public class Example {
public void run() throws ExceptionSubclass {
throw new ExceptionSubclass( "Problem" );
}
}
|
|