public class ExceptionTest4 { public ExceptionTest4(){ try { test(); } catch (TestException ex) { StackTraceElement[] element = ex.getStackTrace(); for (int i = 0 ; i < element.length ; i++) { System.out.println(element[i].toString()); } } } private void test() throws TestException { try { throw new InterruptedException(); } catch (InterruptedException ex) { throw new TestException(ex); } } public static void main(String[] args){ new ExceptionTest4(); } }