Java Exception handling mechanism

Source: Internet
Author: User

The parent class in the exception structure Throwable class, its exception class and the error class.
Error at the system level: An error occurred in the Java Runtime environment. Not controllable
Exception is a program-level error: controllable
GetMessage () Method: Used to get information about the abnormal time.
Printstacktrace () Method: Used to track the contents of the execution stack when an exception event occurs.
Exception exception in Java are divided into:
Non-detection exception (RuntimeException subclass), the most common running exception:
nullpointerexception/, IllegalArgumentException, classcastexception
NumberFormatException, ArrayIndexOutOfBoundsException, ArithmeticException
can detect exceptions (non-runtimeexception subclasses): Compile-time detection, except for exceptions that run at runtime,
is a detectable exception, you must declare the method with THORWS declaration of the type of exception that might be thrown!

Java Exception handling mechanism

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.