Several common runtimeexception in Java

Source: Internet
Author: User
Tags class definition instance method thread class unsupported

Transferred from HTTP://BLOG.CSDN.NET/QQ635785620/ARTICLE/DETAILS/7781026 General interview in Java Exception (runtimeexception There are four or five types of common exceptions that must be asked, which are the basic requirements. More .... It is important to note that several common types of accumulation are as follows: NullPointerException-NULL pointer reference exception
ClassCastException-type cast exception.
IllegalArgumentException-Pass an illegal parameter exception.
ArithmeticException-Arithmetic Operation exception
Arraystoreexception-Storing an incompatible object exception with the declaration type in the array
Indexoutofboundsexception-Subscript out-of-bounds exception
Negativearraysizeexception-Create an array error exception with a negative size
NumberFormatException-Numeric 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 ended exception: Eofexception
File not found exception: FileNotFoundException
string conversion to numeric exception: NumberFormatException
Manipulating Database Exceptions: SQLException
Input/Output exception: IOException
Method not found exception: Nosuchmethodexception

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

Java.lang.AssertionError
Assertion is wrong. Used to indicate a condition in which an assertion failed.

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

Java.lang.ClassFormatError
The class format is incorrect. Thrown when a Java virtual machine attempts to read a Java class from a file and detects that the contents of the file do not conform to the valid format of the class.

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

Java.lang.ExceptionInInitializerError
Initialization program error. Thrown when an exception occurs during the execution of a static initializer for a class. Static initializers refer to static statement segments that are included directly in the class.

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

Java.lang.IncompatibleClassChangeError
Incompatible class change error. This exception is thrown when an incompatible change is made to the class definition on which the method being executed depends. This error is easily thrown when you modify the declaration definition for some classes in your app without recompiling the entire application.

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

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

Java.lang.LinkageError
Link error. The error and all its subclasses indicate that a class depends on another class, and after that class is compiled, the dependent class changes its class definition without recompiling all of the classes, which in turn raises the error condition.

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 are no errors 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 of that domain in the definition of that class.

Java.lang.NoSuchMethodError
Method has no errors. This error is thrown when an application attempts to invoke a method of a class that does not have the definition of the method in the definition of the class.

Java.lang.OutOfMemoryError
Insufficient memory error. This error is thrown when the available memory is insufficient for a Java virtual machine to be assigned to an object.

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

Java.lang.ThreadDeath
The thread ends. This error is thrown when the stop method of the thread class is called to indicate the end of the thread.

Java.lang.UnknownError
Unknown error. Used to indicate a situation in which a Java virtual machine has an unknown critical error.

Java.lang.UnsatisfiedLinkError
An unsatisfied link error. Thrown when a Java virtual machine does not find a class that is declared as a native language definition of the 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 minor 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 issue in a class file.

Java.lang.VirtualMachineError
Virtual machine error. A condition that indicates that the virtual machine is compromised or that the resource required to continue performing the operation is 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 arrays.

Java.lang.ArrayStoreException
Array storage exception. Thrown when a non-array declaration type object is placed into the array.

Java.lang.ClassCastException
Class shape exception. Assuming that there are classes A and B (A is not a parent or subclass of B), and 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 called coercion type conversion exception.

Java.lang.ClassNotFoundException
The class exception could not be found. This exception is thrown when an application attempts to construct a class based on a class name in string form, and when a 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 exception is thrown by calling its clone () method.

Java.lang.EnumConstantNotPresentException
An enumeration constant does not have an exception. 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, accesses the class property, calls the class method, and then cannot access the definition of a class, property, method, or constructor method.

Java.lang.IllegalMonitorStateException
Violations of the monitoring State anomalies. This exception is thrown when a thread tries to wait for a monitor that does not own the object (O) or notifies other threads to wait for the object (O).

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

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

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

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

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.

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
No exception exists for the property. This exception is thrown when a property that does not exist for a class is accessed.

Java.lang.NoSuchMethodException
Method has no exception. This exception is thrown when a non-existent method of a class is accessed.

Java.lang.NullPointerException
Null pointer exception. This exception is thrown when an app tries to use null where the object is required. For example: Call an instance method of a Null object, access the properties of a null object, evaluate the length of a null object, throw null with a 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, and the string does not satisfy the format required by the number type.

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

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

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, and the index value is less than 0 or greater than or equal to the sequence size.

Java.lang.TypeNotPresentException
There is no exception for type. The exception is thrown when an app tries to access the type as a string representation of a type name, but the type is not found according to the given name. The difference between this exception and ClassNotFoundException is that the exception is unchecked (not checked) and ClassNotFoundException is a checked (checked) exception.

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

Several common runtimeexception in Java

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.