摘要: package com.lyc.struct;public class TestDemo01 { public static void main(String[] args) { //打印5行三角形 for (int i = 1; i <= 5; i++) { for (int j = 5; j > 阅读全文
posted @ 2021-01-07 17:00 liuyunche 阅读(291) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class LabelDemo { public static void main(String[] args) { //打印101~150之间的所有质数 //质数是指在大于1的自然数中,除了1和它本身以外不再有其他因数的自然数。 int 阅读全文
posted @ 2021-01-07 16:22 liuyunche 阅读(575) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;//break与continue的区别//break在任何循环语句的主体部分,均可用break控制循环的流程。// break用于强行退出循环,不执行循环中剩余的语句。// (break语句也在switch语句中使用)//continue语句用在循环语句 阅读全文
posted @ 2021-01-06 21:57 liuyunche 阅读(89) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class BreakDemo { public static void main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if (i== 阅读全文
posted @ 2021-01-06 21:51 liuyunche 阅读(68) 评论(0) 推荐(0) 编辑
摘要: break continuebreak在任何循环语句的主体部分,均可用break控制循环的流程。break用于强行退出循环,不执行循环中剩余的语句。(break语句也在switch语句中使用)continue 语句用在循环语句体中,用于终止某次循环过程,即跳过循环体中尚未执行的语句,接着进行下一次是 阅读全文
posted @ 2021-01-06 21:47 liuyunche 阅读(55) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class ForDemo05 { public static void main(String[] args) { int[] numbers = {10,20,30,40,50,60} ; //遍历数组的结果 //把numbers里的结 阅读全文
posted @ 2021-01-06 21:41 liuyunche 阅读(122) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class ForDemo04 { public static void main(String[] args) { //打印九九乘法表 for (int i = 1; i <= 9; i++) { for (int j = 1; j <= 阅读全文
posted @ 2021-01-06 21:31 liuyunche 阅读(75) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class ForDemo03 { public static void main(String[] args) { //用while或for循环输出1-1000之间能被5整除的数,并且每行输出3个 for (int i = 0; i <= 阅读全文
posted @ 2021-01-06 21:00 liuyunche 阅读(544) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class ForDemo02 { public static void main(String[] args) { //练习1:计算0到100之间的奇数和偶数的和 int odd = 0; int even = 0; //偶数// for 阅读全文
posted @ 2021-01-06 20:47 liuyunche 阅读(93) 评论(0) 推荐(0) 编辑
摘要: package com.lyc.struct;public class ForDemo01 { public static void main(String[] args) { int a = 1; while (a<=100){//条件判断 System.out.println(a); a+=2; 阅读全文
posted @ 2021-01-06 20:27 liuyunche 阅读(129) 评论(0) 推荐(0) 编辑