Java Thread .get Default Uncaught Exception Handler ()

Syntax

Thread.getDefaultUncaughtExceptionHandler() has the following syntax.

public static Thread.UncaughtExceptionHandler getDefaultUncaughtExceptionHandler()

Example

In the following code shows how to use Thread.getDefaultUncaughtExceptionHandler() method.


class ThreadDemo extends Thread {
//from  w ww .  j ava  2s  .  c  om
  public void run() {
    System.out.println("Thread = " + getName());
    Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler();
    System.out.println(handler);
  }
}

public class Main {

  public static void main(String[] args) {

    ThreadDemo t = new ThreadDemo();
    t.start();
  }

}




















Home »
  Java Tutorial »
    java.lang »




Boolean
Byte
Character
Class
Double
Enum
Float
Integer
Long
Math
Number
Object
Package
Process
ProcessBuilder
Runnable
Runtime
SecurityManager
Short
StackTraceElement
StrictMath
String
StringBuffer
StringBuilder
System
Thread
ThreadGroup
ThreadLocal
Throwable