摘要: package struct; public class BreakContinueGoToD3 { public static void main(String[] args) { //goto不在Java之中,但有他的影子 //打印101-150之间的质数 //不建议使用!!! outer:fo 阅读全文
posted @ 2025-06-18 21:17 萧xiao 阅读(0) 评论(0) 推荐(0)
摘要: package struct; public class BreakContinueGoToD2 { public static void main(String[] args) { int a=0; while(a<30){ a++; if(a%5==0){ continue;//continue 阅读全文
posted @ 2025-06-18 21:17 萧xiao 阅读(0) 评论(0) 推荐(0)
摘要: package struct; public class BreakContinueGoTo { public static void main(String[] args) { int a=0; while(a<50){ a++; System.out.println(a); if(a==30){ 阅读全文
posted @ 2025-06-18 21:15 萧xiao 阅读(0) 评论(0) 推荐(0)
摘要: 主要便利数组 package struct; public class ForD5 { public static void main(String[] args) { int[] numbers={1,2,3,4,5};//定义了一个数组 for(int i:numbers){ //便利数组的元素 阅读全文
posted @ 2025-06-18 20:16 萧xiao 阅读(1) 评论(0) 推荐(0)
摘要: package struct; public class ForD4 { public static void main(String[] args) { //打印九九乘法表: for (int i = 1; i <= 9; i++) {//1.首先打印第一列 for (int j = 1; j < 阅读全文
posted @ 2025-06-18 20:14 萧xiao 阅读(0) 评论(0) 推荐(0)
摘要: //0~1000能被5整除的数,每行只输出三个 package struct; public class ForD3 { public static void main(String[] args) { //0~1000能被5整除的数,每行只输出三个 for (int i = 0; i <= 100 阅读全文
posted @ 2025-06-17 21:27 萧xiao 阅读(0) 评论(0) 推荐(0)
摘要: //0~100之中奇数与偶数的和: package struct; public class ForD2 { //0~100之中奇数与偶数的和: public static void main(String[] args) { int oddsum=0;//偶数的和 int evensum=0;// 阅读全文
posted @ 2025-06-17 21:27 萧xiao 阅读(1) 评论(0) 推荐(0)
摘要: package struct; public class ForD1 { public static void main(String[] args) { //while与for的区别 int a=0; //初始化条件 while(a<10){ //条件判断 a++; //迭代(更新) System 阅读全文
posted @ 2025-06-17 21:25 萧xiao 阅读(3) 评论(0) 推荐(0)
摘要: package struct; public class DowhileD1 { public static void main(String[] args) { int a=0; //直接循环 while(a<0){ System.out.println(a); } System.out.prin 阅读全文
posted @ 2025-06-17 16:16 萧xiao 阅读(1) 评论(0) 推荐(0)
摘要: 1+2+3+4+...+100的计算方法 package struct; public class WhileD2 { public static void main(String[] args) { //1+2+3+...+100的算数: int a=0; int sum=0; while(a<= 阅读全文
posted @ 2025-06-17 15:53 萧xiao 阅读(0) 评论(0) 推荐(0)