Java Learning Note Error and exception connection

Source: Internet
Author: User

Contact for error and exception:

The connection between error and exception

  • Inheritance structure: Both error and exception inherit from Throwable,runtimeexception inherited from exception.

  • The error and runtimeexception and their subclasses are called unchecked exceptions (unchecked exception), and other exceptions become checked exceptions (Checked exception).

The difference between error and exception
  • The error class generally refers to problems associated with virtual machines, such as system crashes, virtual machine errors, insufficient memory space, overflow of method call stacks, and so on. such as Java.lang.StackOverFlowError and Java.lang.OutOfMemoryError. For such errors, the Java compiler does not check them. For this kind of error caused by the application interruption, only by the program itself cannot be recovered and prevented, encountered such errors, it is recommended to let the program terminate.

  • The exception class represents exceptions that the program can handle and can be captured and possibly recovered. If you encounter such an exception, you should handle the exception as much as possible so that the program resumes running, rather than terminating the exception arbitrarily.

Java Learning Note Error and exception connection

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.