Jen Baby Java Basic Notes Flow control (ii)

Source: Internet
Author: User

1. Each cycle can be nested with each other
Generally no more than three floors
The outer loop variable changes once, and the inner loop variable is changed again
Note: Number of cycles. (Inner loop number * Outer loop number)
Use of 2.break statements
The break statement terminates a loop and causes the program to jump to the next statement outside the loop block.
The statement after break in the loop is no longer executed, and the loop stops executing.
The break statement can be used not only in the For loop, but also in the while and do-while loops.
The break statement is typically used with an if conditional statement.
3. Use of Continue statements
The continue can be used for a for loop or for a while and do-while loops.
In the For loop, continue causes the program to jump to the iteration section before judging the loop condition.
If true, the next loop is resumed, otherwise the loop is terminated.
In the while loop, when the continue is executed, the program will directly determine the loop condition.
The continue statement can only be used in a looping structure.
4. Comparison:
The break statement terminates a loop, and the program jumps to the next statement outside the loop block.
The continue statement is to jump out of the loop and into the next loop.
5.return terminating the main function
6. Program debugging
Set breakpoints
Single Step operation (F6)
Observing variables

Jen Baby Java Basic Notes Flow control (ii)

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.