- Java.lang - Void
- Java.lang - Throwable
- Java.lang - ThreadLocal
- Java.lang - ThreadGroup
- Java.lang - Thread
- Java.lang - System
- Java.lang - StringBuilder
- Java.lang - StringBuffer
- Java.lang - String
- Java.lang - StrictMath
- Java.lang - StackTraceElement
- Java.lang - Short
- Java.lang - SecurityManager
- Java.lang - RuntimePermission
- Java.lang - Runtime
- Java.lang - ProcessBuilder
- Java.lang - Process
- Java.lang - Package
- Java.lang - Object
- Java.lang - Number
- Java.lang - Math
- Java.lang - Long
- Java.lang - Integer
- Java.lang - InheritableThreadLocal
- Java.lang - Float
- Java.lang - Enum
- Java.lang - Double
- Java.lang - Compiler
- Java.lang - ClassLoader
- Java.lang - Class
- Java.lang - Character.UnicodeBlock
- Java.lang - Character.Subset
- Java.lang - Character
- Java.lang - Byte
- Java.lang - Boolean
- Java.lang - Home
Java.lang Package extras
Java.lang Package Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Java.lang.Throwable Class
Introduction
The java.lang.Throwable class is the superclass of all errors and exceptions in the Java language. Only objects that are instances of this class (or one of its subclasses) are thrown by the Java Virtual Machine or can be thrown by the Java throw statement.
Class Declaration
Following is the declaration for java.lang.Throwable class −
pubpc class Throwable extends Object implements Seriapzable
Class constructors
Sr.No. | Constructor & Description |
---|---|
1 | Throwable() This constructs a new throwable with null as its detail message. |
2 | Throwable(String message) This constructs a new throwable with the specified detail message. |
3 | Throwable(String message, Throwable cause) This constructs a new throwable with the specified detail message and cause. |
4 | Throwable(Throwable cause) This constructs a new throwable with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). |
Class methods
Sr.No. | Method & Description |
---|---|
1 | This method fills in the execution stack trace. |
2 | This method returns the cause of this throwable or null if the cause is nonexistent or unknown. |
3 | This method creates a locapzed description of this throwable. |
4 | This method returns the detail message string of this throwable. |
5 | This method provides programmatic access to the stack trace information printed by printStackTrace(). |
6 | This method initiapzes the cause of this throwable to the specified value. |
7 | This method prints this throwable and its backtrace to the standard error stream. |
8 | This method prints this throwable and its backtrace to the specified print stream. |
9 | This method prints this throwable and its backtrace to the specified print writer. |
10 | This method sets the stack trace elements that will be returned by getStackTrace() and printed by printStackTrace() and related methods. |
11 | This method returns a short description of this throwable. |
Methods inherited
This class inherits methods from the following classes −
java.lang.Object