Java the type of exception that appears in
Missing format parameter exception
java.util.MissingFormatArgumentException Exception
Error message:
java.util.MissingFormatArgumentException:
Format specifier ' s '
Cause: string formatting provides fewer values than the number of string format characters (%s)
Parameters:
Format-A formatted string that is described in the syntax of a format string
Args-the parameter referenced by the format specifier in the format string. If the arguments are more than the format specifier, the extra arguments are ignored. The number of parameters is variable and can be zero. The maximum number of parameters is limited by the maximum dimensions of the Java array defined by Java Virtual Machine specification. The behavior of the null parameter depends on the conversion.
Number Format exception
Java.lang.NumberFormatException
Error message:
Java.lang.NumberFormatException: For input string: "1"
Reason: This statement explicitly tells us that the number format is abnormal, followed by a for input string: "1" hint, this tells us that you want to convert "1" to a numeric type error.
Null pointer exception
Java.lang.NullPointerException
Error message:
ExceptionIn thread "main":java.lang.NullPointerException
cause: null pointer exception. This exception is thrown when an app tries to use null where the object is required. For example: Call an instance method of a Null object, access the properties of a null object, evaluate the length of a null object, throw null with a throw statement, and so on.
Note:
There are several reasons for the general report java.lang.NullPointerException:
1) • The string variable is not initialized;
2) • Objects of the interface type are not initialized with a specific class, such as:
List lt; Will error
List lt = new ArrayList (); You won't get an error.
3) • When the value of an object is empty, you are not judged to be empty.
Array out of bounds exception (index out of bounds exception)
Java.lang.IndexOutOfBoundsException
Error message:
java.lang.IndexOutOfBoundsException : index:0, size:0
Cause: index out-of-bounds exception. This exception is thrown when an index value that accesses a sequence is less than 0 or greater than or equal to the sequence size.
File not found exception
Java.io.FileNotFoundException
Error message:
Java.io.FileNotFoundException:File does not exist
Cause: This is an IO exception, and the English obvious hint is that the file cannot be found, indicating that the path of file is not written.
Exception types that occur in Java