Java's built-in exceptions

In the standard package java.lang, Java class defines several exceptions. The previous example was used in some of them. These abnormalities typically standard class is a subclass of RuntimeException. Since java.lang actually introduced all Java programs, most derived from RuntimeException exceptions are automatically available. Moreover, they need not be included in any of the methods throws list. Java language, this is called unchecked exceptions (unchecked exceptions). It is because the compiler does not check to see whether a process or method throws these exceptions. java.lang defined unchecked exception listed in Table 10-1. Table 10-2 lists must be included in the exception list method throws defined by java.lang, if one of these methods which can produce abnormal but it can not deal with their own. These are called by the checked exceptions (checked exceptions). Java defines several other anomalies associated with different types of libraries.

Unchecked Table 10-1 Java exception classes defined in java.lang
abnormal Explanation
ArithmeticException Arithmetic errors such as division by 0
ArrayIndexOutOfBoundsException Under an array boundary marked
ArrayStoreException Array element assignment types are incompatible
ClassCastException Illegal type coercion
IllegalArgumentException Parameter method call illegal
IllegalMonitorStateException Illegal monitoring operation, such as waiting an unlocked thread
IllegalStateException Environment or application status is incorrect
IllegalThreadStateException Requested operation is not compatible with the current thread state
IndexOutOfBoundsException Certain types of index out of bounds
NullPointerException Illegal use of a null reference
NumberFormatException Illegal string conversion to digital format
SecurityException Attempt to violate security
StringIndexOutOfBounds In addition to trying to index a string boundary
UnsupportedOperationException Encountered an unsupported operating

 

Table 10-2 abnormalities defined in java.lang
abnormal significance
ClassNotFoundException Class not found
CloneNotSupportedException Attempting to clone an object that can not implement the Cloneable interface
IllegalAccessException Access is denied to a class
InstantiationException Trying to create an abstract class object or abstract interface
InterruptedException A thread is interrupted by another thread
NoSuchFieldException Requested field is not present
NoSuchMethodException The method requested does not exist

 

VII. Multithreaded programming
1. The concept of threads
2. the Java threading model
3. The main thread
4. Create a thread
5. Create a multithreaded
6. Use isAlive () and join () of
7. thread priority
8. thread synchronization
9. communication between the threads
10. a thread deadlock
11. the thread suspend, resume and terminate

Guess you like

Origin blog.csdn.net/Javaxuxuexi/article/details/92428397