摘要:
案例 public class MethodDemo11 { public static void main(String[] args) { judge(); } //加法 public static double add(double x,double y) { return x + y; } 阅读全文
posted @ 2021-06-26 17:24
多瑞C
阅读(31)
评论(0)
推荐(0)
摘要:
递归 public class MethodDemo09 { //2! 2*1 //3! 3*2*1 //5! 5*4*3*2*1 public static void main(String[] args) { MethodDemo09 demo09 = new MethodDemo09(); i 阅读全文
posted @ 2021-06-26 17:22
多瑞C
阅读(32)
评论(0)
推荐(0)
摘要:
可变参数 实际上参数是数组 public class MethodDemo07 { public static void main(String[] args) { MethodDemo07 demo07 = new MethodDemo07(); demo07.test(1,2,3,4,5,6,7 阅读全文
posted @ 2021-06-26 17:19
多瑞C
阅读(34)
评论(0)
推荐(0)
摘要:
方法的重载 public class MethodDemo05 { public static void main(String[] args) { int add1 = add(1, 2); System.out.println(add1); System.out.println(" "); in 阅读全文
posted @ 2021-06-26 17:16
多瑞C
阅读(35)
评论(0)
推荐(0)
摘要:
方法的定义 形式参数:用来定义作用的 实际参数:实际调用传递给它的参数 方法调用 public class MethodDemo02 { public static void main(String[] args) { int max = max(1, 1); System.out.println( 阅读全文
posted @ 2021-06-26 17:08
多瑞C
阅读(58)
评论(0)
推荐(0)
摘要:
何谓方法 public class MethodDemo01 { //main方法 public static void main(String[] args) { int sum = add(1, 2); System.out.println(sum); } //加法 public static 阅读全文
posted @ 2021-06-26 17:05
多瑞C
阅读(61)
评论(0)
推荐(0)
摘要:
循环结构 1、while循环 public class WhileDemo01 { public static void main(String[] args) { //输出1~100 int i = 0; while ( i < 100 ) { i++; System.out.println(i) 阅读全文
posted @ 2021-06-26 17:02
多瑞C
阅读(47)
评论(0)
推荐(0)
摘要:
选择结构 1、if单选择结构 public class IfSingle { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("请输入内容:"); if 阅读全文
posted @ 2021-06-26 16:53
多瑞C
阅读(73)
评论(0)
推荐(0)
摘要:
顺序结构 public class Order { public static void main(String[] args) { System.out.println("Hello1"); System.out.println("Hello2"); System.out.println("Hel 阅读全文
posted @ 2021-06-26 16:51
多瑞C
阅读(30)
评论(0)
推荐(0)
摘要:
Scanner对象 1、使用next方式接收 public class UserInputNext { public static void main(String[] args) { //创建一个扫描器对象,用于接收键盘数据 Scanner sc = new Scanner(System.in); 阅读全文
posted @ 2021-06-26 16:43
多瑞C
阅读(90)
评论(0)
推荐(0)
浙公网安备 33010602011771号