📄 son.java
字号:
package chapter7;
class Son implements Father {
public void method() {
System.out.println("i am son");
}
public static void main(String[] args) {
Father father;
father = new Son();
father.method();
// father = new Son1();
// father.method();
//
// father = new Son2();
// father.method();
father=new SonExtend();
father.method();
}
}
class SonExtend extends Son{
public void method(){
System.out.println("i am a new method ");
}
}
class Son1 implements Father {
public void method() {
System.out.println("i am son1");
}
}
class Son2 implements Father {
public void method() {
System.out.println("i am son2");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -