Uncaught.java Source code

Java tutorial

Introduction

Here is the source code for Uncaught.java

Source

public class Uncaught implements Runnable {

    public static void main(String[] args) {
        Thread thread = new Thread(new Uncaught());
        thread.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            public void uncaughtException(Thread t, Throwable e) {
                e.printStackTrace();
            }
        });
        thread.start();
    }

    public void run() {
        throw new ArithmeticException();
    }

}