OK, this is one of the worst programming examples ever, but I tried it while studying someone else's question and found the results a bit strange. Any explanation?
public class Test {
static class Bizarre extends RuntimeException {
public void throwMe() {
throw this;
}
}
public static void main(String[] args) {
Bizarre biz = new Bizarre();
System.out.println("Output line 1");
biz.throwMe();
System.out.println("Output line 2");
}
}
Result:
Output line 1
Exception in thread "main" Test$Bizarre
at Test.main(Test.java:12)
Why line 12?
source
share