摘要: super super是调用父类的构造方法,必须在构造方法的第一个 super必须只能出现在子类的方法或者构造方法中 super和this不能同时调用构造方法 VS this 代表的对象不同: this:本身调用者这个对象 super:代表父类对象的应用 前提: this:没有继承也可以使用 sup 阅读全文
posted @ 2021-01-24 16:24 王剑锋123 阅读(83) 评论(0) 推荐(0)
摘要: 面向对象 方法 静态方法:和类一起加载 非静态方法:类实例化之后才存在 值传递与引用传递 //引用传递 public class yin { public static void main(String[] args) { stud s = new stud(); System.out.printl 阅读全文
posted @ 2021-01-24 15:07 王剑锋123 阅读(126) 评论(0) 推荐(0)
摘要: 数组 //静态初始化 int[]a={1,2,3}; //动态初始化 int[]b=new int[3]; //int[]b; 数组的声明 (栈) //b=new int [3];数组的创建 (堆) System.out.println(a[0]); System.out.println(b[0]) 阅读全文
posted @ 2021-01-24 14:25 王剑锋123 阅读(145) 评论(0) 推荐(0)
摘要: 增强for循环 int []s={10,20,30,40,50}; //常规 for (int i = 0; i < 5; i++) { System.out.println(s[i]); } System.out.println(" "); //增强for for(int j:s) { Syste 阅读全文
posted @ 2021-01-24 12:27 王剑锋123 阅读(129) 评论(0) 推荐(0)