摘要: 画三角形 package com.struct; public class TextDemo01 { public static void main(String[] args) { //打印三角形 for (int i = 1;i <= 5;i++){ for (int j = 5;j>=i;j- 阅读全文
posted @ 2021-06-01 23:44 颂溪庄 阅读(151) 评论(0) 推荐(0)
摘要: continue package com.struct; public class ContinueDemo01 { public static void main(String[] args) { int i = 0; while (i<100){ i++; if (i%10==0){ Syste 阅读全文
posted @ 2021-06-01 23:42 颂溪庄 阅读(76) 评论(0) 推荐(0)
摘要: break package com.struct; public class BreakDemo01 { public static void main(String[] args) { int i = 0; while (i<100){ i++; System.out.println(i); if 阅读全文
posted @ 2021-06-01 23:40 颂溪庄 阅读(47) 评论(0) 推荐(0)
摘要: switch结构 package com.struct; public class SwitchDemo01 { public static void main(String[] args) { char grade = 'C'; //switch 匹配一个具体的值 switch (grade){ 阅读全文
posted @ 2021-06-01 23:38 颂溪庄 阅读(104) 评论(0) 推荐(0)
摘要: for结构 package com.struct; ​ public class FoDemo01 { public static void main(String[] args) { int a = 1;//初始化条件 ​ while (a<=100){ System.out.println(a) 阅读全文
posted @ 2021-06-01 23:35 颂溪庄 阅读(103) 评论(0) 推荐(0)
摘要: if结构 package com.struct; //if单选择结构 import java.util.Scanner; public class IfDemo01 { public static void main(String[] args) { Scanner scanner = new Sc 阅读全文
posted @ 2021-06-01 23:32 颂溪庄 阅读(104) 评论(0) 推荐(0)
摘要: DoWhile结构 package com.struct; public class DoWhile01 { public static void main(String[] args) { ////计算 1+2+3+...+100=? int i = 0; int sum = 0; do{ sum 阅读全文
posted @ 2021-06-01 23:30 颂溪庄 阅读(89) 评论(0) 推荐(0)
摘要: while结构 package com.struct; //while循环 public class WhileDemo01 { public static void main(String[] args) { //输出1~100 int i = 0; while (i<100){ i++; Sys 阅读全文
posted @ 2021-06-01 23:29 颂溪庄 阅读(50) 评论(0) 推荐(0)
摘要: 顺序结构 package com.struct; public class SequenceDemo01 { public static void main(String[] args) { System.out.println("hello01"); System.out.println("hel 阅读全文
posted @ 2021-06-01 23:25 颂溪庄 阅读(35) 评论(0) 推荐(0)
摘要: 输入scanner 1.next() package com.scanner; import java.util.Scanner; /** * next(); * 一定要读取到有效字符后才可以结束输入, * next();不能得到带有控格的字符串。 * 对输入有效字符之前遇到的空格,会自动将其去掉。 阅读全文
posted @ 2021-06-01 10:08 颂溪庄 阅读(593) 评论(0) 推荐(0)