Location>code7788 >text

Summer Java self-study progress summary 06

Popularity:2 ℃/2024-08-16 20:40:02
I. What we learned today:
circulate
for(initialization statement; conditional judgment statement; conditional control statement){
A loop body statement; the
}
Execute the process:
1> Execute the initialization statement
2> Execute the conditional judgment statement, if true, then the execution of the loop body statement, if false, the end of the loop
3> Execute Conditional Control Statements
4> go back to 2> continue with the conditional judgment statement
Note: The initialization statement is executed only once
circulate
Initialization statements.
while (conditional judgment statement) {
Loop statement body;
Conditional Control Statements;
}
Comparison with while loop
Same point:
The rules are the same.
Points of difference:
1> In a for loop, the variables that control the loop, because they are attributed to the structure of the for loop statement, cannot be accessed after the for loop ends.
2> In a while loop, the variables controlling the loop are not part of the structure of the loop statement, so they remain accessible after the while loop ends.
3> In a for loop, know the number of loops or the loop range
4> In a while loop, the number and range of the loop are not known, only the condition for the end of the loop
II. Preparing for school tomorrow:
1. The concept of arrays
2. Static and dynamic initialization of arrays
3. Addresses and element access methods for arrays