摘要: 多态注意事项: 1.多态是方法的多态,属性没有多态 2.父类和子类有联系,类型转换异常!ClassCastException! 3.存在的条件:继承关系,方法需要重写 父类引用指向子类对象! Father S1 = new Son(); 1.static方法不能重写 2.final 常量 不能重写 阅读全文
posted @ 2020-07-08 09:15 光光1234 阅读(125) 评论(0) 推荐(0) 编辑
摘要: //重写是方法的重写与属性无关 重写:需要有继承关系,子类重写父类的方法! 1.方法名必须相同. 2.参数列表必须相同 3.修饰符范围可以扩大: public > Protected > Default > private 4.抛出的异常 : 范围可以被缩小,但不能扩大。 ClassNotFound 阅读全文
posted @ 2020-07-07 21:35 光光1234 阅读(96) 评论(0) 推荐(0) 编辑
摘要: Super 的注意点: 1.Super调用父类的构造方法,必须在构造方法的第一个 2.Super只能出现在子类的方法或者构造方法中 3.Super和 this 不能同时调用构造方法Vs this : 代表的对象不同: this: 本身调用者这个对象 super: 代表父类对象的应用 前提: this 阅读全文
posted @ 2020-07-06 23:25 光光1234 阅读(112) 评论(0) 推荐(0) 编辑
摘要: public static void main(String[] args) { Student S1 = new Student(); String Ao = S1.getName(); S1.setName("敖晨光"); System.out.println(S1.getName()); S1 阅读全文
posted @ 2020-07-04 22:44 光光1234 阅读(125) 评论(0) 推荐(0) 编辑
摘要: /*1.类是一个模板:抽象 。 对象是一个具体的实例;2.方法的定义与调用。3.对象的引用引用类型: 基本类型(8);对象是通过引用来操作的:栈 >堆4.属性:字段(Field) 成员变量默认初始化:数字:0 0.0char: u0000boolean true or false引用:null修饰符 阅读全文
posted @ 2020-07-04 22:05 光光1234 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-07-04 21:44 光光1234 阅读(79) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2020-06-23 22:51 光光1234 阅读(115) 评论(0) 推荐(0) 编辑
摘要: package com.AoChenguang.Array;public class ArrayDemon6<array> { public static void main(String[] args) { //创建二维数组 11*11 0没有 棋子 1白棋 2 黑棋 int[][] array 阅读全文
posted @ 2020-06-13 17:15 光光1234 阅读(94) 评论(0) 推荐(0) 编辑
摘要: public static void main(String[] args) { int[] array={1,2,3,4,5}; // for (int arrays : array) { // System.out.print(arrays); //} // PrintArrays(array) 阅读全文
posted @ 2020-06-04 20:19 光光1234 阅读(112) 评论(0) 推荐(0) 编辑
摘要: package com.AoChenguang.Array;public class ArrayDemon1 { public static void main(String[] args) { int [] a={1,2,3,4,5,6,7,8,9};//静态初始化 创建+赋值 System.ou 阅读全文
posted @ 2020-06-04 18:19 光光1234 阅读(139) 评论(0) 推荐(0) 编辑