In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "what are Java loops and array exercises". In daily operation, I believe many people have doubts about Java loops and array exercises. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the questions of "what are Java loops and array exercises?" Next, please follow the editor to study!
Examples of loops:
While loop and do... While cycle
Whlie (conditional statement) {Loop body} / / first judge the conditional statement, and then proceed the loop body.
Do {Loop body} whlie (conditional statement) / / execute a loop first and then judge the conditional statement
Break statement
Break statement: ends all loops. The specific application is as follows:
1000) {break;// when the sum is greater than 1000, use the breakstatement to jump out of the loop}} System.out.println (I);}
Related example exercises:
1. Output 100 to 1000 daffodils:
Public class LoopTest {public static void main (String [] args) {int bai = 0; int shi = 0; int ge = 0; for (int I = 100; I < 1000; iAccording +) {bai = I bai 10; ge = I; if (bai*bai*bai+shi*shi*shi+ge*ge*ge = = I) {System.out.println (I);}}
two。 Print all letters:
Public class LoopTest {public static void main (String [] args) {char lower = 'a'; char upper =' Aids; for (int I = 0; I < 26; iTunes +) {System.out.println (lower+ "" + upper); lower++; upper++;}
3. Print the 99 multiplication table:
Public class LoopTest {public static void main (String [] args) {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.