Java Learning Notes

Source: Internet
Author: User

The eclipse has been downloaded for a long time, and in addition to JFrame and BigInteger, there has been no use of other Java features. On the occasion of Android, learn Java fundamentals by the way.

  First, try, catch, finally

This set of keywords is useful when debugging a project, because even if the program has an error, it does not end the program directly, but instead uses the catch to output the error message (or location). It should be said to be more useful.

Baidu a bit, found in C + + actually have try and catch keyword .... In vain I learned C + + has been 3 years, the results even the basis of the key words have not touched the familiar .... It was a shame. However, there is no finally keyword in C + +.

This set of keywords runs roughly: If a program executed in a try executes correctly, the catch is not executed, and if a program executing in a try has an error, the code in the try is immediately stopped, and the code in the catch is run instead. And finally it's all going to run.

Interestingly, the code written after the code is also running. (I don't know what's the use of finally ...) )

1 Try2 {3     inti = 1/1;4System.out.println ("Try");5 }6 Catch(Exception e)7 {8System.out.println ("Catch");9 }Ten finally One { ASystem.out.println ("Finally"); - } -System.out.println ("End");
View Code

Java Learning Notes

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.