1. Java.lang.NullPointerException (null pointer exception)
An uninitialized object or an object that does not exist is called
Often appear in the Create picture, call array in these operations, than the slice is not initialized, or the picture is created when the path error and so on. A null pointer appears in the array operation,
The initialization of the array and the initialization of the set element are confused. The initialization of an array is the space required for the allocation of arrays, and the initialized array, where the elements are not instantiated,
is still empty, so it is necessary to initialize each element (if it is to be called).
2. Java.lang.ClassNotFoundException
The specified class does not exist
The main consideration here is whether the name and path of the class are correct, usually when a program attempts to load a class by using a string that may throw an exception
For example: Call Class.forName ();
Or call Classload's Finasystemclass (); or loadclass ();
3. Java.lang.NumberFormatException
string conversion to numeric exception
This exception is thrown when an attempt is made to convert a string to the specified number type, and the string does not satisfy the format required by the number type. This is allowed when the data "123456" of the character type is now converted to numeric data.
However, if the character data contains non-numeric characters, such as 123#56, an exception occurs when converted to a numeric type. The system catches the exception and processes it.
4. Java.lang.IndexOutOfBoundsException
Array subscript out of bounds exception
Looking at the array of calls or the subscript value of a string is not beyond the range of the array, generally speaking, the display (that is, directly with the constant subscript) call is not easy to make such a mistake, but the implicit (that is, the use of variable-subscript) calls are often wrong, there is a situation, The length of the array defined in the program is determined by certain methods and is not declared beforehand, so it is better to look at the length of the array before this exception occurs.
5. Java.lang.IllegalAccessException
No access rights
This exception occurs when the application is calling a class, but the current method does not have access to the class. Note This exception in cases where the package is used in the program
6. Java.lang.ArithmeticException
Mathematical Operation Anomaly
Such an exception occurs when an arithmetic operation is divided by 0.
7. Java.lang.ClassCastException
Data type Conversion exception
This exception is thrown when an attempt is made to force a downward transformation on an object, but the object is not convertible and cannot be converted to an instance of its child class, such as the following code.
Object obj = new Integer (0);
String str = obj;
8. Java.lang.FileNotFoundException
File not found exception
This exception is thrown when a program tries to open a nonexistent file for read-write. The exception is thrown by the constructor declaration of the Fileinputstream,fileoutputstream,randomaccessfile
Even if the file being manipulated exists but is inaccessible for some reason, such as opening a read-only file for writing, these construction methods still throw an exception
9. Java.lang.ArrayStoreException
Array Store exception
An exception is thrown when an attempt is made to save an object of type incompatible type to an object[] array
object[] obj = new String[3];
Obj[0] = new Integer (0);
Ten. Java.lang.NoSuchMethodException
method does not exist exception
An exception is thrown when a program attempts to create an object through reflection, access (modify or Read) a method, but the method does not exist
Java.lang.EOFException.
File has ended exception
An exception is thrown when the program encounters the end of a file or stream during the input process. Therefore, the exception is used to check whether the end of the file or stream is reached
Java.lang.InstantiationException.
Instantiating an exception
When you try to create an instance of a class through the class's Newinstance () method, but the program cannot create the object through the constructor, it throws
Class object represents an abstract class, interface, array class, base type
The class represented by this class does not have a corresponding constructor
13:java.lang.interruptedexception
Aborted exception
This exception is thrown when a thread is in a long wait, hibernate, or other paused state while another thread terminates the thread through the interrupt method of the thread.
14:java.lang.outofmemoryexception
Low Memory error
This error is thrown when the available memory is insufficient for a Java virtual machine to be assigned to an object.
15:java.io.notserializableexception
Unable to serialize exception
It is generally necessary to serialize an object, because an object does not implement the serializable interface and causes the object to not serialize the reported exception.
Summary of Common Java exceptions