123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- package com.loveCoding.j20250426_java_basic;
- /**
- * @author WanJl
- * @version 1.0
- * @title Demo09
- * @description
- * @create 2025/4/26
- */
- public class Demo09 {
- public static void main(String[] args) {
- /*
- for(int i=0;i<10;i++){
- System.out.println(i)
- }
- for(初始化语句;循环条件;迭代语句){
- 循环体
- }
- int i=0; 初始化语句
- while(i<10){ 循环条件
- System.out.println(i); 循环体
- i++; 迭代语句
- }
- int i=0; 初始化语句
- do{
- System.out.println(i); 循环体
- i++; 迭代语句
- }while(i<10); 循环条件
- 循环语句的执行步骤
- 1、先执行初始化语句
- 2、执行判断条件语句,如果判断结果为true,则执行3,为false则执行5
- 3、执行循环体
- 4、执行迭代语句,执行第2。
- 5、结束循环
- */
- /*
- 1、编写代码,计算出1000以内的水仙花数。
- 例如:153。1*100+5*10+3 == 1^3+5^3+3^3 满足条件则是水仙花数
- 100以上的三位数,这个数的个位+十位+百位的结果和这个数的每个位上的值的3次方相等
- */
- /*
- for (;; ) {
- System.out.println("hello");
- }
- while(true){
- System.out.println("hello");
- }
- */
- }
- }
|