# IllegalArgumentException

public class **IllegalArgumentException** extends [RuntimeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/RuntimeException.html)  

|---|---|---|
| Known Direct Subclasses [IllegalChannelGroupException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/IllegalChannelGroupException.html), [IllegalCharsetNameException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/IllegalCharsetNameException.html), [IllegalFormatException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatException.html), [IllegalSelectorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/IllegalSelectorException.html), [IllegalThreadStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalThreadStateException.html), [InvalidParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidParameterException.html), [InvalidPathException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/InvalidPathException.html), [NumberFormatException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NumberFormatException.html), [PatternSyntaxException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/PatternSyntaxException.html), [ProviderMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/ProviderMismatchException.html), [UnresolvedAddressException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/UnresolvedAddressException.html), [UnsupportedAddressTypeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/UnsupportedAddressTypeException.html), [UnsupportedCharsetException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/UnsupportedCharsetException.html) |---|---| | [IllegalChannelGroupException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/IllegalChannelGroupException.html) | Unchecked exception thrown when an attempt is made to open a channel in a group that was not created by the same provider. | | [IllegalCharsetNameException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/IllegalCharsetNameException.html) | Unchecked exception thrown when a string that is not a [legal charset name](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Charset#names) is used as such. | | [IllegalFormatException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatException.html) | Unchecked exception thrown when a format string contains an illegal syntax or a format specifier that is incompatible with the given arguments. | | [IllegalSelectorException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/IllegalSelectorException.html) | Unchecked exception thrown when an attempt is made to register a channel with a selector that was not created by the provider that created the channel. | | [IllegalThreadStateException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalThreadStateException.html) | Thrown to indicate that a thread is not in an appropriate state for the requested operation. | | [InvalidParameterException](https://developers.google.com/j2objc/javadoc/jre/reference/java/security/InvalidParameterException.html) | This exception, designed for use by the JCA/JCE engine classes, is thrown when an invalid parameter is passed to a method. | | [InvalidPathException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/InvalidPathException.html) | Unchecked exception thrown when path string cannot be converted into a `https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/Path.html` because the path string contains invalid characters, or the path string is invalid for other file system specific reasons. | | [NumberFormatException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NumberFormatException.html) | Thrown to indicate that the application has attempted to convert a string to one of the numeric types, but that the string does not have the appropriate format. | | [PatternSyntaxException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/regex/PatternSyntaxException.html) | Unchecked exception thrown to indicate a syntax error in a regular-expression pattern. | | [ProviderMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/file/ProviderMismatchException.html) | Unchecked exception thrown when an attempt is made to invoke a method on an object created by one file system provider with a parameter created by a different file system provider. | | [UnresolvedAddressException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/UnresolvedAddressException.html) | Unchecked exception thrown when an attempt is made to invoke a network operation upon an unresolved socket address. | | [UnsupportedAddressTypeException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/channels/UnsupportedAddressTypeException.html) | Unchecked exception thrown when an attempt is made to bind or connect to a socket address of a type that is not supported. | | [UnsupportedCharsetException](https://developers.google.com/j2objc/javadoc/jre/reference/java/nio/charset/UnsupportedCharsetException.html) | Unchecked exception thrown when no support is available for a requested charset. | |||

|---|---|---|
| Known Indirect Subclasses [DuplicateFormatFlagsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DuplicateFormatFlagsException.html), [FormatFlagsConversionMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/FormatFlagsConversionMismatchException.html), [IllegalFormatCodePointException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatCodePointException.html), [IllegalFormatConversionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatConversionException.html), [IllegalFormatFlagsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatFlagsException.html), [IllegalFormatPrecisionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatPrecisionException.html), [IllegalFormatWidthException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatWidthException.html), [MissingFormatArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/MissingFormatArgumentException.html), [MissingFormatWidthException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/MissingFormatWidthException.html), [UnknownFormatConversionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/UnknownFormatConversionException.html), [UnknownFormatFlagsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/UnknownFormatFlagsException.html) |---|---| | [DuplicateFormatFlagsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/DuplicateFormatFlagsException.html) | Unchecked exception thrown when duplicate flags are provided in the format specifier. | | [FormatFlagsConversionMismatchException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/FormatFlagsConversionMismatchException.html) | Unchecked exception thrown when a conversion and flag are incompatible. | | [IllegalFormatCodePointException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatCodePointException.html) | Unchecked exception thrown when a character with an invalid Unicode code point as defined by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Character.html#isValidCodePoint(int)` is passed to the `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Formatter.html`. | | [IllegalFormatConversionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatConversionException.html) | Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type. | | [IllegalFormatFlagsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatFlagsException.html) | Unchecked exception thrown when an illegal combination flags is given. | | [IllegalFormatPrecisionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatPrecisionException.html) | Unchecked exception thrown when the precision is a negative value other than -1, the conversion does not support a precision, or the value is otherwise unsupported. | | [IllegalFormatWidthException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/IllegalFormatWidthException.html) | Unchecked exception thrown when the format width is a negative value other than -1 or is otherwise unsupported. | | [MissingFormatArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/MissingFormatArgumentException.html) | Unchecked exception thrown when there is a format specifier which does not have a corresponding argument or if an argument index refers to an argument that does not exist. | | [MissingFormatWidthException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/MissingFormatWidthException.html) | Unchecked exception thrown when the format width is required. | | [UnknownFormatConversionException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/UnknownFormatConversionException.html) | Unchecked exception thrown when an unknown conversion is given. | | [UnknownFormatFlagsException](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/UnknownFormatFlagsException.html) | Unchecked exception thrown when an unknown flag is given. | |||

Thrown to indicate that a method has been passed an illegal or
inappropriate argument.

### Public Constructor Summary

|---|---|
|   | [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html#IllegalArgumentException())() Constructs an `IllegalArgumentException` with no detail message. |
|   | [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html#IllegalArgumentException(java.lang.String))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) s) Constructs an `IllegalArgumentException` with the specified detail message. |
|   | [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html#IllegalArgumentException(java.lang.String,%20java.lang.Throwable))([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Constructs a new exception with the specified detail message and cause. |
|   | [IllegalArgumentException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/IllegalArgumentException.html#IllegalArgumentException(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Constructs a new 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). |

### Inherited Method Summary

From class [java.lang.Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html)

|---|---|
| synchronized final void | [addSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#addSuppressed(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) exception) Appends the specified exception to the exceptions that were suppressed in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [fillInStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#fillInStackTrace())() Fills in the execution stack trace. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause())() Returns the cause of this throwable or `null` if the cause is nonexistent or unknown. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getLocalizedMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getLocalizedMessage())() Creates a localized description of this throwable. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [getMessage](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getMessage())() Returns the detail message string of this throwable. |
| StackTraceElement\[\] | [getStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace())() Provides programmatic access to the stack trace information printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()`. |
| synchronized final [Throwable\[\]](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [getSuppressed](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getSuppressed())() Returns an array containing all of the exceptions that were suppressed, typically by the `try`-with-resources statement, in order to deliver this exception. |
| synchronized [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) | [initCause](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#initCause(java.lang.Throwable))([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause) Initializes the *cause* of this throwable to the specified value. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace())() Prints this throwable and its backtrace to the standard error stream. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintWriter))([PrintWriter](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintWriter.html) s) Prints this throwable and its backtrace to the specified print writer. |
| void | [printStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace(java.io.PrintStream))([PrintStream](https://developers.google.com/j2objc/javadoc/jre/reference/java/io/PrintStream.html) s) Prints this throwable and its backtrace to the specified print stream. |
| void | [setStackTrace](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#setStackTrace(java.lang.StackTraceElement[]))(StackTraceElement\[\] stackTrace) Sets the stack trace elements that will be returned by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getStackTrace()` and printed by `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#printStackTrace()` and related methods. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#toString())() Returns a short description of this throwable. |

From class [java.lang.Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html)

|---|---|
| [Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) | [clone](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#clone())() Creates and returns a copy of this `Object`. |
| boolean | [equals](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#equals(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) obj) Compares this instance with the specified object and indicates if they are equal. |
| void | [finalize](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#finalize())() Invoked when the garbage collector has detected that this instance is no longer reachable. |
| final [Class](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html)\<?\> | [getClass](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#getClass())() Returns the unique instance of `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Class.html` that represents this object's class. |
| int | [hashCode](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#hashCode())() Returns an integer hash code for this object. |
| final void | [notify](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notify())() Causes a thread which is waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| final void | [notifyAll](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#notifyAll())() Causes all threads which are waiting on this object's monitor (by means of calling one of the `wait()` methods) to be woken up. |
| [String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) | [toString](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#toString())() Returns a string containing a concise, human-readable description of this object. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long,%20int))(long timeout, int nanos) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait(long))(long timeout) Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object or until the specified timeout expires. |
| final void | [wait](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html#wait())() Causes the calling thread to wait until another thread calls the `notify()` or `notifyAll()` method of this object. |

## Public Constructors

#### public
**IllegalArgumentException**
()

Constructs an `IllegalArgumentException` with no
detail message.

#### public
**IllegalArgumentException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) s)

Constructs an `IllegalArgumentException` with the
specified detail message.

##### Parameters

| s | the detail message. |
|---|---|

#### public
**IllegalArgumentException**
([String](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/String.html) message, [Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause)

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

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

##### Parameters

| message | the detail message (which is saved for later retrieval by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getMessage()` method). |
| cause | the cause (which is saved for later retrieval by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause()` method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) |
|---|---|

#### public
**IllegalArgumentException**
([Throwable](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html) cause)

Constructs a new 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 exceptions that are little more than
wrappers for other throwables (for example, `https://developers.google.com/j2objc/javadoc/jre/reference/java/security/PrivilegedActionException.html`).

##### Parameters

| cause | the cause (which is saved for later retrieval by the `https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Throwable.html#getCause()` method). (A null value is permitted, and indicates that the cause is nonexistent or unknown.) |
|---|---|