Hallo,
bis jetzt habe ich ja immer gedacht ich hätte das dynamische Binden verstanden, aber warum gibt der folgende code "throwable" aus, und nicht "exception" ?
Gruss
Schnabel
bis jetzt habe ich ja immer gedacht ich hätte das dynamische Binden verstanden, aber warum gibt der folgende code "throwable" aus, und nicht "exception" ?
Java:
public class LateBinding {
public static void main(String[] args) {
new LateBinding().go();
}
void go() {
try {
throw new Exception();
} catch (Throwable t) {
this.handle(t);
}
}
void handle(Throwable t) {
System.out.println("throwable");
}
void handle(Exception t) {
System.out.println("excepiton");
}
}
Gruss
Schnabel