摘要:
package base.method;import java.util.Scanner;public class Demo06 { //写一个计器,要求实现加减乘除功能,并且能够循环接收新的数据,通过用户交互实现 public static void main(String[] args) { S 阅读全文
posted @ 2022-05-14 16:49
怎样的人生
阅读(33)
评论(0)
推荐(0)
摘要:
递归 package base.method;public class Demo05 { //递归思想 public static void main(String[] args) { System.out.println(f(5)); } //1! 1 //2! 2*1 //3! 3*2*1 / 阅读全文
posted @ 2022-05-14 16:48
怎样的人生
阅读(5)
评论(0)
推荐(0)
摘要:
可变参数 package base.method;public class Demo04 { public static void main(String[] args) { Demo04 demo04 = new Demo04(); demo04.test(2,3,8,20,40,100); } 阅读全文
posted @ 2022-05-14 15:39
怎样的人生
阅读(23)
评论(0)
推荐(0)
摘要:
命令行传参 package base.method;public class Demo03 { public static void main(String[] args) { // args.,数组长度 for (int i = 0; i < args.length; i++) { System 阅读全文
posted @ 2022-05-14 15:21
怎样的人生
阅读(18)
评论(0)
推荐(0)
摘要:
方法讲解 package base.method;public class Demo01 { //什么叫方法 //main方法 public static void main(String[] args) { //实际参数:实际调用传递给他的参数 int sum=add(1,2); System. 阅读全文
posted @ 2022-05-14 14:40
怎样的人生
阅读(44)
评论(0)
推荐(0)
摘要:
流程控制练习题 打印三角形 package base.struct;public class TestDemo1 { public static void main(String[] args) { //打印三角形 5行 for (int i=1;i<=5;i++){ for (int j = 5 阅读全文
posted @ 2022-05-13 20:46
怎样的人生
阅读(21)
评论(0)
推荐(0)
摘要:
break continue label package base.struct;public class BreakDemo1 { public static void main(String[] args) { int i=0; while (i<100){ i++; System.out.p 阅读全文
posted @ 2022-05-13 20:23
怎样的人生
阅读(21)
评论(0)
推荐(0)
摘要:
增强for循环 package base.struct;public class ForDemo5 { public static void main(String[] args) { //定义了一个数组 int[] numbers={10,20,30,40,50}; for (int i=0;i 阅读全文
posted @ 2022-05-13 18:21
怎样的人生
阅读(9)
评论(0)
推荐(0)
摘要:
for循环 package base.struct;public class ForDemo1 { public static void main(String[] args) { int a=1;//初始化条件 while(a<=100){//条件判断 System.out.println(a) 阅读全文
posted @ 2022-05-13 18:03
怎样的人生
阅读(71)
评论(0)
推荐(0)
摘要:
循环结构 do while循环 package base.struct;public class DoWhileDemo1 { public static void main(String[] args) { //计算1+2+3+。。。。+100,使用do while int i=0; int s 阅读全文
posted @ 2022-05-13 16:39
怎样的人生
阅读(67)
评论(0)
推荐(0)