public class UncaughtExceptionTest1_1 { public UncaughtExceptionTest1_1() { ThreadGroup group = new MyThreadGroup("Group"); Thread thread = new Thread(group, new Task(), "task"); thread.start(); try { while (true) { Thread.sleep(10000L); } } catch (InterruptedException ex) {} } class MyThreadGroup extends ThreadGroup { public MyThreadGroup(String name) { super(name); } public void uncaughtException(Thread t, Throwable e) { System.out.println("Uncaught Exception!!!"); e.printStackTrace(); } } class Task implements Runnable { public void run() { try { Thread.sleep(1000L); } catch (InterruptedException ex) {} throw new RuntimeException(); } } public static void main(String[] args) { new UncaughtExceptionTest1_1(); } }