Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

IllegalArgumentException

The JDK's exception for an argument a method or constructor can't accept.

java.lang.IllegalArgumentException is thrown (throw new IllegalArgumentException(message)) to reject an unacceptable argument; uncaught, it ends the program with a stack trace.

Examples

  • if (amount <= 0) throw new IllegalArgumentException("amount must be positive: " + amount);

Read the full section →