IllegalArgumentException — invalid argument
IllegalArgumentException signals that a method received an illegal or inappropriate argument. It is an unchecked exception: the compiler does not require callers to catch it or declare it with throws.
CKTIS / Java
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
IllegalArgumentException signals that a method received an illegal or inappropriate argument. It is an unchecked exception: the compiler does not require callers to catch it or declare it with throws.
IllegalMonitorStateException indicates, among other cases, a call to wait(), notify(), or notifyAll() without owning the target object's monitor. Fixing it requires synchronization on the correct object, not merely catching the exception.
lang.IllegalStateException: practical reference: IllegalStateException signals that a call is invalid for the receiver's current state rather than merely for an argument value.
IndexOutOfBoundsException signals an index outside the permitted range. Learn its relationship to RuntimeException, its specialized subclasses, and how to validate an array index explicitly.
InterruptedException is a checked exception signaling interruption of an operation such as Thread.sleep. Learn how the exception differs from the interrupt flag and how to preserve the signal when handling it.
MethodHandle is a typed reference to an operation. Learn how bindTo binds its first argument and how strict invokeExact differs from type-adapting invoke in Java SE 21.
MethodHandles provides factories and transformations for handles. A Lookup object controls access when handles are created; findVirtual creates an instance-method handle, while findVarHandle provides access to an instance field.
java.lang.invoke.MethodType describes a method handle's return type and ordered parameter types. The MethodType.methodType factory creates this immutable description.
VarHandle provides typed access to variables with selectable memory ordering. Learn getAcquire, setRelease, and compareAndSet, and distinguish data publication from an atomic update.
java.lang.Iterable<T> enables an object to be used in an enhanced for loop. Its iterator() method supplies an iterator, while the default forEach() method applies an action to successive elements.
Math provides static numeric operations. Learn Math.abs and Math.min, including their behavior for extreme integers, NaN, and signed zero.
NullPointerException (NPE) signals the use of null where an object is required. It extends RuntimeException, so it does not need to be declared in throws.
lang.Record: practical reference: Record is the implicit superclass of record classes, whose state is defined by components and generated value-oriented members.
java.lang.reflect.Constructor<T> describes one constructor of class T. It exposes parameter types and annotations and can create objects, subject to access checks and Java SE 21 module boundaries.
java.lang.reflect.Field describes one field and enables access to its value at runtime. It supports inspecting metadata and annotations and changing values, subject to access-control and module-system restrictions.
InvocationHandler defines how a dynamic proxy's methods behave. Learn the InvocationHandler.invoke contract, its arguments, return-value and exception constraints, and handling of Object methods.
A Method object represents a method accessed through reflection. It lets you inspect its name and annotations and invoke it at runtime. Suppressing access checks with setAccessible remains subject to module boundaries.
lang.reflect.ParameterizedType: practical reference: ParameterizedType models a parameterized type such as List<String>, separating raw type from actual type arguments.
Proxy.newProxyInstance creates an object implementing specified interfaces at runtime. Calls go to an InvocationHandler, which determines the result instead of using an ordinary method implementation.
Runnable describes an operation with no parameters and no return value. Its run() method defines the task's action; calling that method alone does not start a new thread.
lang.RuntimeException: practical reference: RuntimeException is the unchecked exception base; callers are not required to catch or declare it.
The JVM can throw StackOverflowError when a computation needs more stack space than the thread is allowed. Deep recursion is a common cause, but a sufficiently deep nonrecursive call chain can also overflow the stack. The error belongs to the Error hierarchy, not Exception; addressing it usually means fixing the method-call structure rather than catching the error.
lang.StrictMath: practical reference: StrictMath provides reproducible core transcendental algorithms with specified fdlibm-based results where documented.
lang.StringBuffer: practical reference: StringBuffer is a mutable synchronized character sequence; individual methods are synchronized but compound protocols need coordination.