摘要: 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) { 阅读全文
posted @ 2021-08-25 17:04 AAA编程 阅读(43) 评论(0) 推荐(0)
摘要: package struct;public class ForDemo05 { public static void main(String[] args) { int[] numbers = {10,20,30,40,50};//定义数组 for (int i = 0; i < 5; i++) { 阅读全文
posted @ 2021-08-25 17:00 AAA编程 阅读(22) 评论(0) 推荐(0)
摘要: package struct;public class ForDemo04 { public static void main(String[] args) { //1.打印第一列 //2.再用一个循环包起来 //3.去掉重复项 //4.调整样式 for (int j = 0; j <= 9; j+ 阅读全文
posted @ 2021-08-25 16:54 AAA编程 阅读(123) 评论(0) 推荐(0)
摘要: package struct;public class ForDemo03 { public static void main(String[] args) { //练习2 用while或for循环输出1-1000之间能被5整除的数,并且每行输出3个 for (int i = 0; i < 1000 阅读全文
posted @ 2021-08-25 16:23 AAA编程 阅读(206) 评论(0) 推荐(0)
摘要: package struct;public class ForDemo02 { public static void main(String[] args) { int oddSum=0; int evenSum=0; for (int i = 0; i < 100; i++) { if(i%2!= 阅读全文
posted @ 2021-08-25 16:16 AAA编程 阅读(38) 评论(0) 推荐(0)
摘要: package struct;public class WhileDemo02 { public static void main(String[] args) { //计算1+2+3...+100=? int i =0; int sum =0; while(i<=100){ sum=sum+i; 阅读全文
posted @ 2021-08-25 15:42 AAA编程 阅读(1050) 评论(0) 推荐(0)
摘要: package struct;public class WhileDemo01 { public static void main(String[] args) { int i =0; while (i<100){ i++; System.out.println(i); } }} 阅读全文
posted @ 2021-08-25 15:31 AAA编程 阅读(1216) 评论(0) 推荐(0)
摘要: package struct;import java.util.Scanner;public class IfDemo03_chengji { public static void main(String[] args) { Scanner scanner = new Scanner(System. 阅读全文
posted @ 2021-08-25 14:45 AAA编程 阅读(59) 评论(0) 推荐(0)
摘要: package struct;public class SwitchDemo01 { public static void main(String[] args) { char grade ='A'; switch (grade){ case 'A': System.out.println("优秀" 阅读全文
posted @ 2021-08-25 14:44 AAA编程 阅读(73) 评论(0) 推荐(0)