wind.java
来自「翁剀JAVA语言那门课程的教案 很多人都看多他的视频教程可惜没有ppt的教案」· Java 代码 · 共 20 行
JAVA
20 行
//: 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 + =
减小字号Ctrl + -
显示快捷键?