Shortest code to throw IllegalArgumentException in Java Okey, we all know the normal way to throw a IllegalArgumentException in Java:

throw new IllegalArgumentException(); // 37 characters


But there must be a shorter (as in less characters) ways to do so.
How can we produce a java.lang.IllegalArgumentException with even less code?


The code fragment has to compile and run in java 7.
No imports/external packages (e.g. not using java.util.Arrays.toString() )

only exception: java.lang because it is automatically imported. 

You can add own
methods/classes.
It must throw a java.lang.IllegalArgumentException

Edit: the error output (stacktrace) must name it java.lang.IllegalArgumentException, so no subclasses of it.



To have a base to start from:

class Titled {
    public static void main(String[] args) {
        throw new IllegalArgumentException();
    }
}
These were all found by grepping the source code in the package java.lang.

All of them result in a "pure" IllegalArgumentException (i.e. not a subclass of it).

The ones marked * only work if you add " throws Exception" (18 characters) to your main declaration, as they throw a checked exception of some kind.

12 (30?) characters*

"".wait(-1);


This will result in:

java.lang.IllegalArgumentException: timeout value is negative


22 (40?) characters*

new Thread().join(-1);


22 characters

Character.toChars(-1);


30 characters

Character.UnicodeBlock.of(-1);