/** * Was passiert, wenn innerhalb eines throw-Statements eine Exception geworfen * wird, oder wenn null geworfen werden soll */ public class ThrowNull { public static void main(String[] args) { try { throw new StupidException(); } catch (Exception e) { System.out.println("Exception 1: "+e); } try { throw null; } catch (Exception e) { System.out.println("Exception 2: "+e); } } } class StupidException extends RuntimeException { /* * Diese dumme Exception macht nichts anderes, als selbst eine Exception zu * werfen */ StupidException() { throw new IllegalArgumentException(); } }