摘要: package struct; public class BreakDemo { public static void main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if (i==30){ Sy 阅读全文
posted @ 2023-11-18 23:21 Cloudhahaha 阅读(11) 评论(0) 推荐(0)
摘要: package struct; public class ForDemo05 { public static void main(String[] args) { //定义:数据类型+变量名 int[] numbers = {10,20,30,40,50};//定义一个数组 for (int i=0 阅读全文
posted @ 2023-11-18 19:06 Cloudhahaha 阅读(10) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2023-11-18 18:37 Cloudhahaha 阅读(216) 评论(0) 推荐(0)
摘要: package struct; //所有的for循环都可以用while循环代替只不过For循环更加高效 public class ForDemo01 { public static void main(String[] args) { int a = 1;//初始化条件 while (a<=100) 阅读全文
posted @ 2023-11-18 18:35 Cloudhahaha 阅读(64) 评论(0) 推荐(0)
摘要: package struct; public class DoWhileDemo01 { public static void main(String[] args) { int i = 0; int sum = 0; do{ sum = sum+i; i++; }while (i<=100); S 阅读全文
posted @ 2023-11-18 15:37 Cloudhahaha 阅读(10) 评论(0) 推荐(0)
摘要: package struct; public class WhileDemo01 { public static void main(String[] args) { int i = 0; while(i<100){ i++; System.out.println(i); } //0-100的数 } 阅读全文
posted @ 2023-11-18 13:10 Cloudhahaha 阅读(11) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2023-11-18 12:17 Cloudhahaha 阅读(10) 评论(0) 推荐(0)