摘要: 内存分析 三种初始化 **int类型没有赋值默认为 0 ** public class ArrayDemo03 { public static void main(String[] args) { //静态初始化:创建 + 赋值 int[] a = {1,2,3,4,5,6,7,8}; System 阅读全文
posted @ 2021-06-27 17:53 多瑞C 阅读(30) 评论(0) 推荐(0)
摘要: 数组 1、定义 2、声明创建 public class ArrayDemo01 { public static void main(String[] args) { //变量的类型 变量的名字 = 变量的值; //第一种创建方式 //int[] nums; //1.声明一个数组 //nums = n 阅读全文
posted @ 2021-06-27 17:50 多瑞C 阅读(150) 评论(0) 推荐(0)
摘要: 案例 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)