In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "introduction to Java basic how to use For cycle", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "introduction to Java how to use For cycle" bar!
I. for Loop statement
1. In java, it is generally used when the number of times is determined. If you want repetitive instruction execution, you can use a for loop. The basic syntax is as follows:
For (initialization expression; Loop condition; Action expression) {C1: execute statement. }
After the for keyword in the above syntax statement, there are three contents, initialization expressions, loop conditions, and action expressions, separated by semicolons (;), and there is an execution statement in the curly braces as the loop body. How is this for loop statement executed?
Take four steps:
Step 1: initialize the expression first
Step 2: execute the loop condition to determine whether the condition is satisfied. If the condition is satisfied, execute the statement of C1. If the condition is not satisfied, exit the for loop.
Step 3: execute the statement of C1
Step 4: execute the action expression, and then repeat the second step
two。 Use the for loop to find the value of the sum of integers from 1 to 10
The code is as follows:
Int sum = 0; for (int I = 1; I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.