public class Solution implements Thread.UncaughtExceptionHandler {

    @Override
    public void uncaughtException(Thread t, Throwable e) {

        t.interrupt();
        List<StackTraceElement> list = Arrays.asList(e.getStackTrace());
        Collections.reverse(list);
        for(StackTraceElement es :list){
            System.out.println(es.toString());
        }
    }

    public static void main(String[] args) {

    }
}