Top Description Fields Constructors
java.lang

public Class RuntimeException

extends Exception
Class Inheritance
Known Direct Subclasses
java.lang.SecurityException, java.lang.TypeNotPresentException, java.lang.UnsupportedOperationException, java.lang.WrongThreadException, java.util.ConcurrentModificationException, java.util.EmptyStackException, java.util.IllformedLocaleException, java.util.MissingResourceException, java.util.NoSuchElementException, java.io.UncheckedIOException, java.lang.invoke.InvokerBytecodeGenerator.BytecodeGenerationException, java.lang.invoke.WrongMethodTypeException, java.lang.annotation.AnnotationTypeMismatchException, java.lang.annotation.IncompleteAnnotationException, java.lang.module.FindException, java.lang.module.InvalidModuleDescriptorException, java.lang.module.ResolutionException, java.lang.reflect.InaccessibleObjectException, java.lang.reflect.MalformedParameterizedTypeException, java.lang.reflect.MalformedParametersException, java.lang.reflect.UndeclaredThrowableException, java.nio.BufferOverflowException, java.nio.BufferUnderflowException, java.nio.file.FileSystemAlreadyExistsException, java.nio.file.FileSystemNotFoundException, java.nio.file.ProviderNotFoundException, java.security.ProviderException, java.time.DateTimeException, java.util.concurrent.CompletionException, java.util.concurrent.RejectedExecutionException, java.util.concurrent.StructureViolationException, jdk.internal.org.objectweb.asm.tree.UnsupportedClassVersionException, sun.reflect.generics.reflectiveObjects.NotImplementedException, sun.security.util.PendingException, jdk.internal.classfile.impl.AbstractPoolEntry.CpException, sun.security.tools.keytool.Main.ExitException, java.lang.ArithmeticException, java.lang.ArrayStoreException, java.lang.ClassCastException, java.lang.EnumConstantNotPresentException, java.lang.IllegalArgumentException, java.lang.IllegalCallerException, java.lang.IllegalMonitorStateException, java.lang.IllegalStateException, java.lang.IndexOutOfBoundsException, java.lang.NullPointerException, java.lang.LayerInstantiationException, java.lang.MatchException, java.lang.NegativeArraySizeException

RuntimeException is the superclass of those exceptions that can be thrown during the normal operation of the Java Virtual Machine.

RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause if they can be thrown by the execution of the method or constructor and propagate outside the method or constructor boundary.

Author
Frank Yellin
Since
1.0
Java Language Specification
11.2 Compile-Time Checking of Exceptions

Field Summary

Modifier and TypeField and Description
pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
RuntimeException()

Constructs a new runtime exception with null as its detail message.

public
RuntimeException(String
the detail message. The detail message is saved for later retrieval by the getMessage() method.
message
)

Constructs a new runtime exception with the specified detail message.

public
RuntimeException(String
the detail message (which is saved for later retrieval by the getMessage() method).
message
,
Throwable
the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
cause
)

Constructs a new runtime exception with the specified detail message and cause.

public
RuntimeException(Throwable
the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
cause
)

Constructs a new runtime exception with the specified cause and a detail message of (cause==null ?

protected
RuntimeException(String
the detail message.
message
,
Throwable
the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.)
cause
,
boolean
whether or not suppression is enabled or disabled
enableSuppression
,
boolean
whether or not the stack trace should be writable
writableStackTrace
)

Constructs a new runtime exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

Field Detail

serialVersionUIDback to summary
pack-priv static final long serialVersionUID

Hides java.lang.Exception.serialVersionUID.

Annotations
@Serial

Constructor Detail

RuntimeExceptionback to summary
public RuntimeException()

Constructs a new runtime exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause.

RuntimeExceptionback to summary
public RuntimeException(String message)

Constructs a new runtime exception with the specified detail message. The cause is not initialized, and may subsequently be initialized by a call to initCause.

Parameters
message:String

the detail message. The detail message is saved for later retrieval by the getMessage() method.

RuntimeExceptionback to summary
public RuntimeException(String message, Throwable cause)

Constructs a new runtime exception with the specified detail message and cause.

Note that the detail message associated with cause is not automatically incorporated in this runtime exception's detail message.

Parameters
message:String

the detail message (which is saved for later retrieval by the getMessage() method).

cause:Throwable

the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Since
1.4
RuntimeExceptionback to summary
public RuntimeException(Throwable cause)

Constructs a new runtime exception with the specified cause and a detail message of (cause==null ? null : cause.toString()) (which typically contains the class and detail message of cause). This constructor is useful for runtime exceptions that are little more than wrappers for other throwables.

Parameters
cause:Throwable

the cause (which is saved for later retrieval by the getCause() method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

Since
1.4
RuntimeExceptionback to summary
protected RuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace)

Constructs a new runtime exception with the specified detail message, cause, suppression enabled or disabled, and writable stack trace enabled or disabled.

Parameters
message:String

the detail message.

cause:Throwable

the cause. (A null value is permitted, and indicates that the cause is nonexistent or unknown.)

enableSuppression:boolean

whether or not suppression is enabled or disabled

writableStackTrace:boolean

whether or not the stack trace should be writable

Since
1.7