Exception

[JavaException]IllegalArgumentException

Reason Thrown to indicate that a method has been passed an illegal or inappropriate argument. argument is actual values that are passed to variables If you put any actual values that is not correct for the variable, it will cause IllegalArgumentException Example int a = 2147483649; // value is too big int a = -2147483649; // value is too small String date="08-07-1990"; // format is dd-MM-yyyy Date format=new SimpleDateFormat("dd/MM/yyyy").parse(date);// format is different Solution check input value range check calculation that can be over the variable limitation use try-catch block

what is difference between Error and Exception in Java

What is Error Programs run something that is not what programmers wanted or shutdown unexpectedly. Any causes of that action are Error. Kinds of Errors compile-time error compile failed. usually, wrong lanuage keyword used. python does not understand “System.out.println” This code is for JAVA. runtime error crash during the programs run. put values in int arr[5] that array size is 3 logical error programmer created wrong process. you wanted to put blue in variable x.