Java know how much (52) built-in exceptions

Source: Internet
Author: User
Tags string to number java throws

In standard package Java.lang, Java defines a number of exception classes. Some of the previous examples have been used. These exceptions are generally subclasses of the standard class runtimeexception. Since Java.lang is actually introduced by all Java programs, most exceptions derived from RuntimeException are automatically available. Furthermore, they do not need to be included in the throws list of any method. In the Java language, this is called an unchecked exception (unchecked exceptions). Because the compiler does not check it to see if a method handles or throws these exceptions. The unchecked exceptions defined in Java.lang are listed in table 10-1. Table 10-2 lists the exceptions defined by Java.lang that must be included in the throws list of methods if they can produce an exception but cannot handle it on their own. These are called checked exceptions (checked exceptions). Java defines several other exception types that are related to non-homogeneous libraries.

table 10-1 Non-checked exception subclasses defined in Java Java.lang
Exception Description
ArithmeticException Arithmetic errors, such as being removed by 0
ArrayIndexOutOfBoundsException Array subscript out of bounds
Arraystoreexception Array element assignment type is incompatible
ClassCastException Illegal cast type
IllegalArgumentException Invalid argument for calling method
Illegalmonitorstateexception Illegal monitoring of operations, such as waiting for an unlocked thread
IllegalStateException The environment or application status is incorrect
Illegalthreadstateexception The request operation is incompatible with the current thread state
Indexoutofboundsexception Some types of indexes are out of bounds
NullPointerException Illegal use of NULL references
NumberFormatException String to number format illegal conversion
SecurityException Attempting to violate security
Stringindexoutofbounds Attempting to index outside the bounds of a string
Unsupportedoperationexception An unsupported operation was encountered

Table 10-2 Check exceptions defined in Java.lang
Exception meaning
ClassNotFoundException The class could not be found
Clonenotsupportedexception Attempting to clone an object that cannot implement the Cloneable interface
Illegalaccessexception Access to a class is denied
Instantiationexception An object that attempts to create an abstract class or an abstract interface
Interruptedexception One thread is interrupted by another thread
Nosuchfieldexception The requested field does not exist
Nosuchmethodexception The requested method does not exist

Series Articles:

Java know how much (top)

Java know how much (interface) interface

Java knows how much (40) the difference between an interface and an abstract class

Java know how much (41) generic explanation

Java know how much (42) the range of generic wildcard characters and type parameters

Java know how much (43) Exception Handling Basics

Java know how much (44) exception type

Java know how much (45) uncaught exceptions

How much Java knows (the) use of try and catch

Java know how much (47) use of multiple catch statements

Java knows how much (in) the nesting of Try statements

Java know how much (a) throw: Exception throws

Java know how many () Java throws clauses

Java knows how many (or) finally

Java know how much (52) built-in exceptions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.