[Java] exception

Source: Internet
Author: User

Java. lang. Exception --- Exception, which can be processed by a program

--- Common method: eg: Exception e

E. getMessage () ---- get exception information

E. toString () --- obtain the exception type and information

E. printStackTrace () --- obtain the exception type, information, and location

--- Category --- exceptions automatically captured by JVM (you can handle them yourself) --- RuntimeException

--- Exceptions that must be captured by developers; otherwise, exceptions cannot be captured through compilation

--- Note --- during method rewriting, the method to be rewritten cannot throw more exceptions than the parent class unless the exception is RuntimeException.

--- Catch does not have to be followed by try, but catch and finally have at least one

--- Try can be followed by multiple catch matches, but note that the exception match is not accurate. The parent class can be connected to the object of the subclass, therefore, the parent class must be placed behind the subclass.

--- If the function tries to catch return fianlly --- then the execution order --- because the function ends when return is encountered and must be executed in any way finally, finally is executed before return.

Java. lang. Error --- Error, system-level Error, which cannot be processed by the program


Author: guomeijuan916

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.