The do...while cycle of Java Learning

Source: Internet
Author: User

Learn to program Java Learning Do...while released, welcome through xuebiancheng8.com to visit

The previous analysis of Java's Process control is divided into select structure, loop structure, wherein the loop structure is divided into while,do...while and for loop

The following is an analysis of the do...while loops in the loop structure

The do...while is similar to the while loop and can also be used for looping operations.

And look at that.

Now to do 10,000 i++ operation what to do, to use the Do...while cycle is so implemented

do{

System.out.println (i);

i++;

}while (i<10000);

The above example is to use the Do...while loop, can help us to print 10,000 times I value, while performing 10,000 i++ operation.

The following is an analysis of the syntax of Do...while

bo=

Cyclic operation;

}while (cyclic conditions);

Do...while loop is characterized by the first execution once, after the execution of a time to judge the conditions, meet the conditions and then execute, not meet the conditions to end, in other words, do...while and while the difference is that while the first judgment after execution, and Do...while to execute at least once.

When the do...while is suitable for at least one time and the number of cycles is not fixed, it is recommended to use a for loop when the number of loops is fixed.

Please visit xuebiancheng8.com for details. The specific URL is

Http://xuebiancheng8.com/play/goodgoodstudy_60_daydayup.html


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.