![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
继承与多态
出道晚了
一个追求梦想的人
展开
-
继承关系
class Parent{ //创建父类 Parent(){ System.out.println("调用父类的parent()构造方法"); } } class SubParent extends Parent{ //继承父类 SubParent(){ System.out.println("调用子类的SubParent()构造原创 2014-11-14 23:24:33 · 233 阅读 · 0 评论 -
方法重载
public class 方法重载 { public static int add(int a, int b){ return a + b ; } public static double add(double a , double b){ return a + b; } public static int add(int a){ return 9; } public s原创 2014-11-19 15:19:41 · 236 阅读 · 0 评论 -
多态和接口
public class 多态 { private 多态[] qtest = new 多态[6]; private int nextIndex = 0; public void draw(多态 q){ if (nextIndex<qtest.length){ qtest[nextIndex] = q; System.out.println(nextIndex); nex原创 2014-11-19 23:12:46 · 209 阅读 · 0 评论