📄 wind.java
字号:
//: Wind.java
// Inheritance & upcasting
import java.util.*;
class Instrument {
protected void play() { System.out.println("Instrument playing"); }
static void tune(Instrument i) {
i.play();
}
}
// Wind object are instruments
// because then have the same interface:
class Wind extends Instrument {
protected void play() { System.out.println("Wind playing"); }
public static void main(String[] args) {
Wind flute = new Wind();
Instrument.tune(flute);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -