• notice
  • Congratulations on the launch of the Sought Tech site

Java built-in exception class Java unchecked exception and checked exception class

Java language defines several exception classes in the Java .lang standard package.

The subclasses of the standard runtime exception class are the most common exception classes. Because the Java .lang package is loaded by default to all Java programs, so the exception class exceptions can be used directly inherited most from the runtime.

Java also defines some other exceptions according to each class library.The following table lists Java's unchecked exceptions.

ArithmeticExceptionWhen an abnormal operation condition occurs, this exception is thrown. For example, when an integer is "divided by zero", an instance of this class is thrown.
ArrayIndexOutOfBoundsExceptionThe exception thrown when accessing an array with an illegal index. If the index is negative or greater than or equal to the size of the array, the index is an illegal index.
ArrayStoreExceptionAn exception thrown when trying to store an object of the wrong type in an object array.
ClassCastExceptionThis exception is thrown when trying to cast an object to a subclass that is not an instance.
IllegalArgumentExceptionThe thrown exception indicates that an illegal or incorrect parameter was passed to the method.
IllegalMonitorStateExceptionThe thrown exception indicates that a thread has tried to wait for the monitor of the object, or tried to notify other monitors that are waiting for the object without specifying the monitor itself.
IllegalStateExceptionA signal generated when a method is called at an illegal or inappropriate time. In other words, the Java environment or Java application is not in the proper state required by the requested operation.
IllegalThreadStateExceptionThe exception thrown when the thread is not in the proper state required by the requested operation.
IndexOutOfBoundsExceptionIndicates that a sort index (such as sorting an array, string, or vector) is out of range.
NegativeArraySizeExceptionIf the application attempts to create an array with a negative size, this exception is thrown.
NullPointerExceptionWhen the application tries to use the object where null it is needed  , the exception is thrown
NumberFormatExceptionThis exception is thrown when the application attempts to convert a string into a numeric type, but the string cannot be converted into an appropriate format.
SecurityExceptionAn exception thrown by the security manager, indicating a security violation.
StringIndexOutOfBoundsExceptionThis exception is String thrown by the  method, indicating that the index is either negative or exceeds the size of the string.
UnsupportedOperationExceptionWhen the requested operation is not supported, this exception is thrown.

The following table lists defined in Java java checked exception class.lang package.

ClassNotFoundExceptionWhen the application tried to load the class, the corresponding class could not be found and the exception was thrown.
CloneNotSupportedExceptionWhen Object a clone method in a class is  called to  clone an object, but the class of the object cannot implement the  Cloneable interface, this exception is thrown.
IllegalAccessExceptionThis exception is thrown when access to a class is denied.
InstantiationExceptionWhen an attempt is made to  create an instance of a class using  Class a  newInstancemethod in the class, and the specified class object cannot be instantiated because it is an interface or an abstract class, the exception is thrown.
InterruptedExceptionA thread was interrupted by another thread, and the exception was thrown.
NoSuchFieldExceptionThe requested variable does not exist
NoSuchMethodExceptionThe requested method does not exist


Technical otaku

Sought technology together

Related Topic


Leave a Reply