Android (Java) Learning Note 82: How do we handle exceptions?

Source: Internet
Author: User

How exactly should we handle exceptions?


If the problem can be handled inside the function, you can solve the problem yourself by using try .

If we can't handle it, we leave it to the caller to handle it, and This is a problem that can't be solved with throws, and we'll just throw it out and give it to the caller to solve the problem (and ultimately , to the JVM)


Subsequent programs need to continue to run on the try

Subsequent programs do not need to continue to run throws


If you have a cold, just take some medicine on your own.

Try to eat for a few days the medicine is not good results have a throws, then the hospital

If the hospital doesn't have a cure, it becomes an error.

Android (Java) Learning Note 82: How do we handle exceptions?

Related Article

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: 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.