Click to enter _ more _java thousand ask
What are the common errors in Java?
Want to learn about anomalies see here: What is an exception in Java
Common run-time exceptions look here: What are the common Java exceptions (runtime)
Common non-runtime exceptions look here: What are common Java exceptions (non-runtime)
In addition to exception exception in Java, there is a large class of errors, namely error, our common error is as follows:
1, 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.
Reason:
- The external resources that are accessed by the system are not executed, which causes the external resources to be wasted and eventually can cause the system not to function properly.
- Too many external resources are being accessed by the system, and the external system is unable to handle it properly;
- An exception occurred with the external resources accessed by the system.
Solution:
- Before accessing external resources, first check whether the resource (such as a database) can connect or operate properly.
- When accessing external resources, if a connection is made, it must be closed and only one shutdown will be performed.
- Try to share external resources in the same operation to reduce the consumption of resources and improve the efficiency of program execution.
2, Java.lang.AbstractMethodError
Abstract method Error. Thrown when an application tries to invoke an abstract method.
3, Java.lang.AssertionError
Assertion is wrong. Used to indicate a condition in which an assertion failed.
4, 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.
5, 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.
6, 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.
7, 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.
8, 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.
9, 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.
10, Java.lang.InternalError
Internal error. Used to indicate an internal error occurred with the Java virtual machine.
11, 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.
12, 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.
13, 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.
14, 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.
15, 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.
16, 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.
17, 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.
18, Java.lang.UnknownError
Unknown error. Used to indicate a situation in which a Java virtual machine has an unknown critical error.
19, 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.
20, 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.
21, Java.lang.VerifyError
Validation error. This error is thrown when the validator detects an internal incompatibility or security issue in a class file.
22, 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 thousand asked _04 exception handling (008) _java common errors are what