A method has been passed an illegal or inappropriate argument value.
Thrown by Java methods or libraries when caller code supplies parameter values that break precondition constraints (e.g., negative timeout or empty URL).
Passing negative numbers to methods requiring positive dimensions, or invalid string format values to domain constructors.
1public class Account {2 public void setAge(int age) {3 if (age < 0 || age > 150) {4 throw new IllegalArgumentException("Age must be between 0 and 150");5 }6 }7 8 public static void main(String[] args) {9 Account acc = new Account();10 acc.setAge(-5); // Throws IllegalArgumentException!11 }12}1public class Account {2 public void setAge(int age) {3 if (age < 0 || age > 150) {4 throw new IllegalArgumentException("Age must be between 0 and 150");5 }6 }7 8 public static void main(String[] args) {9 Account acc = new Account();10 int userAge = -5;11 12 // Guard / sanitization check13 if (userAge >= 0 && userAge <= 150) {14 acc.setAge(userAge);15 } else {16 System.err.println("Invalid age supplied: " + userAge);17 }18 }19}Simulate standard system builds to trigger compiler trace records and track memory crashes locally.
Passing `-5` violates domain validation rules defined in `setAge()`, causing explicit `IllegalArgumentException`.