[Posts] Java for loop

java for loop

HTTPS: // baijiahao.baidu.com/s?id=1621622990642364099&wfr=spider&for=pc 

find themselves even   for implementation cycle have forgotten ..

Study hard but forget things too easy ..

 

Night confessed Programming

Date: 01-03 15:23

About java for loop surely we have some understanding, for one cycle is commonly used java statement to learn. for statement is the most flexible and most commonly used loop structure. Its structure is such that we can Figure. This is the basic structure of the for loop.

Execution of the for statement is

[1] Solving Ordinary expressions.

Solving the conditional expression [2], if the value is true, execution loop statement block, then in step 3; if false, the loop out of the statement.

[3 ] solving cycle expression, then turned back to step 2.

For loop can easily simplify a lot of code in place, making it easy to read the code. For example, so you need a lot of trouble over and over again the output of the string of a string output statement, now do not need, just need to use a for loop you can get. For instance, we give an example, 10 times in the console output "Hello," if we do not learn cycle, you will not be marked 10 times over and over again, "Hello"? But now we can be very simple to use for loop only needs to complete such a code on it, see the figure, this is not simple.

After learning of the for loop is that we often use to. Therefore, we must learn this knowledge. The for loop will continue to deepen learning. Next we look at it is not very easy to see the case through a small, handy it. 1-100 calculated and accumulated. We write the code or through eclipse. It is not very easy to do.

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/11940324.html