What is the difference between error and exception?

Source: Internet
Author: User

Error indicates system-level errors and exceptions that the program does not have to handle, an internal error in the Java Runtime environment, or a hardware problem. For example: insufficient memory resources and so on. For this kind of error, the program is basically powerless, except to exit the operation has no choice, it is thrown by the Java virtual machine.

Exception (violation) indicates an exception that needs to be captured or handled by the program, which deals with problems caused by flaws in the design of the program or general problems caused by external input, which must be handled by the program.
Exception is also divided into run-time exceptions, subject to check exceptions.
A run-time exception, which represents an exception that cannot be recovered by the program, is usually caused by an incorrect operation that is recommended to terminate the program, so the compiler does not check for these exceptions.
A checked exception is an exception that indicates that the program can handle, which means that the program can be repaired (by the program itself accepting the exception and processing it), so it is called a check exception.

What is the difference between error and exception?

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.