摘要: for循环 for(初始化;布尔表达式;更新){ //代码} int a = 0;for(int i = 0;i<=100;i++){//快捷键:100.fori a += i;}System.out.println(a); for循环是支持迭代的一种通用结构,是最有效、最灵活的循环结构 for循环 阅读全文
posted @ 2021-04-26 11:14 Bilia 阅读(118) 评论(0) 推荐(0) 编辑
摘要: char grade = 'B';​switch (grade){ case 'A': System.out.println("优秀"); break;//可选 case 'B': System.out.println("良好"); break; case 'C': System.out.print 阅读全文
posted @ 2021-04-26 10:05 Bilia 阅读(44) 评论(0) 推荐(0) 编辑
摘要: while循环 while(布尔表达式){ } 只要表达式为true,循环就会一直走下去 一定需要一个让表达式失效的方式 //输出1-100int i = 0;while (i<100){ i++; System.out.println(i);}//死循环while(true){ } do whil 阅读全文
posted @ 2021-04-26 10:03 Bilia 阅读(113) 评论(0) 推荐(0) 编辑