Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {

    public static void main(String[] args) {

        Thread t = new Thread(new MyThread());

        t.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            public void uncaughtException(Thread t, Throwable e) {
                System.out.println(t + " throws exception: " + e);
            }
        });
        t.start();
    }
}

class MyThread implements Runnable {

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