Java Check Exception (checked exception) and non-checked exception (unchecked exception) differential understanding

Source: Internet
Author: User

All exception types are subclasses of the Throwable class, which contains the exception class and the error class, and exception also includes checked exception and unchecked exception.

The unchecked Exception:java compiler does not require that an unchecked exception be caught or thrown, and can be handled without processing. Such exceptions are usually logically faulty and can be avoided by modifying the code. This type of exception occurs when compilation is compiled in Eclipse (save as compile).

The checked Exception:java compiler requires that the check exception must be caught or thrown, that there is no error in the code logic, but that the program is running with an exception due to errors such as IO, which you do not anticipate during the programming phase. If you do not handle these exceptions, the program will definitely go wrong in the future. So the compiler will prompt you to catch and handle this possible exception, and it cannot be compiled without processing.

Java Check Exception (checked exception) and non-checked exception (unchecked exception) differential understanding

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.