Explanation of common anomalies in java.lang.Exception

Source: Internet
Author: User
Tags arithmetic class definition instance method thread class unsupported
In general interview the Java Exception (runtimeexception) is the question that must be asked the common exception list four or five kinds, is the basic requirement. More .... Attention needs to accumulate several common types as follows: NullPointerException-NULL pointer reference exception
ClassCastException-type cast exception.
IllegalArgumentException-Pass Illegal parameter exception.
ArithmeticException-Arithmetic Operation exception
Arraystoreexception-Object exception that is incompatible with declaring type in array
Indexoutofboundsexception-Subscript out of bounds exception
Negativearraysizeexception-Create an array error exception with a negative size
NumberFormatException-Number Format exception
SecurityException-Security exception
Unsupportedoperationexception-Unsupported Operation exception

Arithmetic Exception class: Arithmeticexecption
Null pointer exception class: NullPointerException
Type cast Exception: ClassCastException
Array negative subscript exception: Negativearrayexception
Array subscript out of bounds exception: ArrayIndexOutOfBoundsException
Violation of security principle exception: Secturityexception
File closed Exception: Eofexception
The file did not find an exception: FileNotFoundException
string conversion to numeric exception: NumberFormatException
Manipulating Database Exceptions: SQLException
Input and output exception: IOException
Method did not find an exception: Nosuchmethodexception

Java.lang.AbstractMethodError
Abstract method Error. Thrown when an application attempts to invoke an abstract method.

Java.lang.AssertionError
Assertion is wrong. Used to indicate a failure of an assertion.

Java.lang.ClassCircularityError
Class loop dependency error. When a class is initialized, the exception is thrown if a circular dependency between the classes is detected.

Java.lang.ClassFormatError
Class format error. Thrown when the Java Virtual machine attempts to read a Java class from a file and detects that the contents of the file do not conform to a valid format for the class.

Java.lang.Error
Error. is the base class for all errors that identify serious program-run problems. These issues often describe anomalies that should not be captured by the application.

Java.lang.ExceptionInInitializerError
Initialization program error. Thrown when an exception occurs while executing the static initialization program for a class. A static initialization program refers to a static statement segment that is directly contained in a class.

Java.lang.IllegalAccessError
Illegal access error. This exception is thrown when an application attempts to access, modify, or call its methods on a class's domain, but violates the visibility declaration of a field or method.

Java.lang.IncompatibleClassChangeError
Incompatible class change error. This exception is thrown when an incompatible change occurs on the class definition that the method being executed is dependent on. This error is easily raised in cases where the declaration definition of some classes in the application is modified without recompiling the entire application and running directly.

Java.lang.InstantiationError
Instantiating an error. This exception is thrown when an application attempts to construct an abstract class or interface through the Java new operator.

Java.lang.InternalError
Internal error. Used to indicate an internal error occurred in the Java virtual machine.

Java.lang.LinkageError
Link error. The error and all of its subclasses indicate that a class relies on other classes, after which the dependent class changes its class definition without recompiling all classes, causing an error.

Java.lang.NoClassDefFoundError
Class definition error not found. This error is thrown when a Java virtual machine or class loader attempts to instantiate a class and cannot find the definition of the class.

Java.lang.NoSuchFieldError
There is no error in the domain. This error is thrown when an application attempts to access or modify a domain of a class that does not have a definition for that field.

Java.lang.NoSuchMethodError
method does not have an error. This error is thrown when the application attempts to call a method of a class, and the definition of the class does not have the definition of the method.

Java.lang.OutOfMemoryError
There is not enough memory error. This error is thrown when the available memory is not sufficient to allow the Java virtual machine to be assigned to an object.

Java.lang.StackOverflowError
Stack overflow error. This error is thrown when an application of a recursive call is too deep to cause a stack overflow.

Java.lang.ThreadDeath
Thread end. This error is thrown when the stop method of the thread class is invoked to indicate the end of the thread.

Java.lang.UnknownError
Unknown error. Used to indicate a situation where an unknown critical error occurred in the Java virtual machine.

Java.lang.UnsatisfiedLinkError
An unsatisfied link error. Thrown when the Java Virtual machine does not find a native language definition for a class that is declared as a native method.

Java.lang.UnsupportedClassVersionError
Unsupported class version error. This error is thrown when the Java Virtual machine attempts to read a class file, but discovers that the primary and secondary version number of the file is not supported by the current Java virtual machine.

Java.lang.VerifyError
Validation error. This error is thrown when the validator detects an internal incompatibility or security problem in a class file.

Java.lang.VirtualMachineError
Virtual machine error. A condition that indicates that the virtual machine is corrupted or that the resources required to continue the operation are insufficient.

Java.lang.ArithmeticException
Arithmetic condition exception. For example: integers except 0.

Java.lang.ArrayIndexOutOfBoundsException
Array index out of bounds exception. Thrown when the index value of an array is negative or greater than or equal to the size of the array.

Java.lang.ArrayStoreException
Array Store exception. Thrown when a non-array declaration type object is placed in an array.

Java.lang.ClassCastException
Class styling exception. Given that classes A and B (A is not a parent class or subclass of B), O is an instance of a, the exception is thrown when an O is forced to be constructed as an instance of Class B. This exception is often referred to as a coercion type conversion exception.

Java.lang.ClassNotFoundException
The class exception was not found. This exception is thrown when an application attempts to construct a class based on a class name in the form of a string, and when the class file of the corresponding name is not found after traversing Classpah.

Java.lang.CloneNotSupportedException
Cloning exceptions are not supported. When the Cloneable interface is not implemented or the Clone method is not supported, the call to its clone () method throws the exception.

Java.lang.EnumConstantNotPresentException
Enumeration constants do not have exceptions. This exception is thrown when an application attempts to access an enumeration object by name and enumeration type, but the enumeration object does not contain a constant.

Java.lang.Exception
The root exception. Used to describe what the application wants to capture.

Java.lang.IllegalAccessException
An illegal access exception. This exception is thrown when an application attempts to create an instance of a class by reflection, access the Class property, call the class method, and then cannot access the definition of the class's, property, method, or constructor.

Java.lang.IllegalMonitorStateException
Illegal monitoring of state anomalies. This exception is thrown when a thread tries to wait on a monitor for an object (O) that it does not own, or notifies another thread to wait for the monitor for that object (O).

Java.lang.IllegalStateException
Abnormal state of the law. This exception is thrown when the method is called in the Java environment and the application is not already in the legal invocation state of a method.

Java.lang.IllegalThreadStateException
Illegal thread state exception. An exception is thrown when the county seat is not yet in the legal calling state of a method and the method is invoked.

Java.lang.IndexOutOfBoundsException
Index out of bounds exception. This exception is thrown when the index value of the access sequence is less than 0 or greater than or equal to the sequence size.

Java.lang.InstantiationException
Instantiate an exception. When an attempt is made to create an instance of a class through the newinstance () method, and the class is an abstract class or interface, the exception is thrown.

Java.lang.InterruptedException
The exception was aborted. This exception is thrown when a thread is in a long wait, hibernate, or other paused state when another thread terminates the thread through the interrupt method of thread.

Java.lang.NegativeArraySizeException
The array size is a negative value exception. This exception is thrown when an array is created with a negative size value.

Java.lang.NoSuchFieldException
Property does not have an exception. This exception is thrown when a property that does not exist for a class is accessed.

Java.lang.NoSuchMethodException
method does not have an exception. This exception is thrown when a method that does not exist for a class is accessed.

Java.lang.NullPointerException
Null pointer exception. The exception is thrown when an application attempts to use null where the object is required. For example, invoking an instance method of a null object, accessing the properties of a null object, calculating the length of a null object, throwing null with the throw statement, and so on.

Java.lang.NumberFormatException
Number format exception. This exception is thrown when an attempt is made to convert a string to the specified number type, which does not satisfy the format required by the numeric type.

Java.lang.RuntimeException
Run-time exceptions. is the parent class for all exceptions that can be thrown during normal operation of a Java virtual machine.

Java.lang.SecurityException
Security exception. Thrown by the security manager to indicate an exception that violates security conditions.

Java.lang.StringIndexOutOfBoundsException
String index out of bounds exception. This exception is thrown when an index value is used to access a character in a string that is less than 0 or greater than or equal to the sequence size.

Java.lang.TypeNotPresentException
Type does not have an exception. The exception is thrown when the application attempts to access the type as a string expression of a type name, but the type is not found according to the given name. The exception differs from ClassNotFoundException in that the exception is an unchecked (unchecked) exception, and ClassNotFoundException is checked (checked) exception.

Java.lang.UnsupportedOperationException
Unsupported method exception. An exception that indicates that the requested method is not supported.


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.