void () { Throwable causeException; try { throw new NullPointerException(); } catch (final NullPointerException e) { causeException = e; } catch (final IllegalArgumentException e) { causeException = e; } catch (final IndexOutOfBoundsException e) { causeException = e; } System.out.println("causeException = " + causeException); }