摘要: 多态 package oop.demo7;​public class Demo7 { public static void main(String[] args) { //一个对象的实际类型是确定的 new Student()​ Student student=new Student(); //St 阅读全文
posted @ 2021-10-08 17:30 clown-lan 阅读(8) 评论(0) 推荐(0)
摘要: Super 调用父类构造方法,必须第一个 super只能出现在子类构造方法或子类方法中 super和this只能有一个出现在构造方法中 this 本身调用者这个对象 super 代表父类对象的应用 package oop.demo5;​public class Test { public stati 阅读全文
posted @ 2021-10-08 17:29 clown-lan 阅读(24) 评论(0) 推荐(0)
摘要: package oop.demo4;​import oop.demo4.Student;​public class Demo4 { public static void main(String[] args) { Student student=new Student(); student.getN 阅读全文
posted @ 2021-10-07 22:23 clown-lan 阅读(9) 评论(0) 推荐(0)
摘要: package oop.demo3;​public class Demo3 { public static void main(String[] args) { Person person=new Person(); Person person1=new Person("book"); System 阅读全文
posted @ 2021-10-07 21:40 clown-lan 阅读(10) 评论(0) 推荐(0)
摘要: 静态与非静态方法 package oop;​public class Demo { public static void main(String[] args) { Demo.a(); new Demo().b(); } public static void a(){ System.out.prin 阅读全文
posted @ 2021-10-07 21:26 clown-lan 阅读(26) 评论(0) 推荐(0)
摘要: 堆 初始化 package array;​public class Demo { public static void main(String[] args) { //动态初始化, int[] num=new int[10]; System.out.println(num[0]); //0 //静态 阅读全文
posted @ 2021-10-06 21:44 clown-lan 阅读(7) 评论(0) 推荐(0)
摘要: 方法 package method;​public class Demo1 { public static void main(String[] args) { int sum=add(1,2); System.out.println(sum);​ } public static int add(i 阅读全文
posted @ 2021-10-06 20:46 clown-lan 阅读(34) 评论(0) 推荐(0)
摘要: 增强for package base;​public class Demo8 { public static void main(String[] args) { int[] numbers={1,2,3,4,5}; for(int i=0;i<5;i++){ System.out.println( 阅读全文
posted @ 2021-10-06 19:37 clown-lan 阅读(36) 评论(0) 推荐(0)
摘要: switch package base;​public class Demo7 { public static void main(String[] args) { String str="中国"; switch (str){ case "中国": System.out.println("中国"); 阅读全文
posted @ 2021-10-06 10:44 clown-lan 阅读(40) 评论(0) 推荐(0)
摘要: Scanner package base;​import java.util.Scanner;​public class Demo5 { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); 阅读全文
posted @ 2021-10-06 10:43 clown-lan 阅读(18) 评论(0) 推荐(0)