摘要: package com.xu.scanner;import java.util.Scanner;public class Demo05 { public static void main(String[] args) { //我们可以输入多个数字,并求其总和与平均数,每输入一个数字用回车 //确认, 阅读全文
posted @ 2021-05-25 06:24 寻找加油 阅读(48) 评论(0) 推荐(0)
摘要: package com.xu.scanner;import java.util.Scanner;public class Demo04 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); 阅读全文
posted @ 2021-05-25 06:22 寻找加油 阅读(45) 评论(0) 推荐(0)
摘要: package com.xu.scanner;import java.util.Scanner;public class Demo02 { public static void main(String[] args) { //从键盘接收数据 Scanner scanner=new Scanner(S 阅读全文
posted @ 2021-05-25 06:20 寻找加油 阅读(33) 评论(0) 推荐(0)
摘要: package com.xu.scanner;import java.util.Scanner;//导入了Scanner包public class Demo01 { public static void main(String[] args) {//创建一个main方法 //创建一个扫描对象,用于接 阅读全文
posted @ 2021-05-25 06:19 寻找加油 阅读(40) 评论(0) 推荐(0)
摘要: package com.xu.method;public class Demo04 { public static void main(String[] args) { Demo04 demo04=new Demo04(); demo04.test(1); } public void test(in 阅读全文
posted @ 2021-05-25 06:17 寻找加油 阅读(29) 评论(0) 推荐(0)
摘要: package com.xu.method;public class Demo01 { //main方法,public static是修饰符, // void是返回值,返回为空就是不返回的意思; public static void main(String[] args) { // int sum= 阅读全文
posted @ 2021-05-25 06:16 寻找加油 阅读(55) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class WhileDemo02 { public static void main(String[] args) { while(true){ //这个是死循环; //等待客户连接 //定时检查 //。。。。。 } }} "D:\Prog 阅读全文
posted @ 2021-05-25 06:14 寻找加油 阅读(28) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class TestDemo { public static void main(String[] args) { //打印三角形 5行 思想及拆分 for (int i = 1; i <=5; i++) { for (int j = 5; 阅读全文
posted @ 2021-05-25 06:13 寻找加油 阅读(33) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class SwitchDemo01 { public static void main(String[] args) { //case穿透,写完每个case后,后面加一个break; //switch匹配一个具体的值 char grade= 阅读全文
posted @ 2021-05-25 06:12 寻找加油 阅读(44) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class ShunXuDemo { public static void main(String[] args) { System.out.println("hello1"); System.out.println("hello2"); S 阅读全文
posted @ 2021-05-25 06:11 寻找加油 阅读(49) 评论(0) 推荐(0)
摘要: package com.xu.struct;import java.util.Scanner;public class IfDemo03 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in) 阅读全文
posted @ 2021-05-25 06:10 寻找加油 阅读(53) 评论(0) 推荐(0)
摘要: package com.xu.struct;import java.util.Scanner;public class IfDemo01 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in) 阅读全文
posted @ 2021-05-25 06:09 寻找加油 阅读(39) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class ForDemo05 {//增强for循环 public static void main(String[] args) { int[] numbers={10,20,30,40,50};//定义了一个数组 for(int i=0; 阅读全文
posted @ 2021-05-25 06:07 寻找加油 阅读(52) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class ForDemo03 { public static void main(String[] args) { //练习2:用while或for循环输出1-1000之间能被5整除的数,并且每行输出3个; for (int i = 0; 阅读全文
posted @ 2021-05-25 06:06 寻找加油 阅读(49) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class ForDemo01 { public static void main(String[] args) { int a=1;//初始化条件 while(a<=100){ System.out.println(a);//循环体 a+= 阅读全文
posted @ 2021-05-25 06:05 寻找加油 阅读(45) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class DoWhileDemo02 { public static void main(String[] args) { int a=0; while(a<0){ System.out.println(a); a++; } System. 阅读全文
posted @ 2021-05-25 06:04 寻找加油 阅读(30) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class DoWhileDemo01 { public static void main(String[] args) { int i=0; int sum=0; do { sum=sum+i; i++; }while(i<=100); S 阅读全文
posted @ 2021-05-25 06:01 寻找加油 阅读(23) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class ContinueDemo01 { public static void main(String[] args) { int i=0; while(i<100){ i++; if(i%10==0){ System.out.print 阅读全文
posted @ 2021-05-25 06:00 寻找加油 阅读(66) 评论(0) 推荐(0)
摘要: package com.xu.struct;public class BreakDemo01 { public static void main(String[] args) { int i=0; while(i<100){ i++; System.out.println(i); if(i==30) 阅读全文
posted @ 2021-05-25 05:59 寻找加油 阅读(37) 评论(0) 推荐(0)