5例子13.txt
来自「这是一本java基础教程 对新手上路有很大帮助」· 文本 代码 · 共 26 行
TXT
26 行
interface Show{
void show();
}
class A implements Show{
public void show(){
System.out.println("I love This Game");
}
}
class B implements Show{
public void show(){
System.out.println("我喜欢看NBA");
}
}
class C{
public void f(Show s){ //接口作为参数
s.show();
}
}
public class Example5_13{
public static void main(String args[]){
C c=new C();
c.f(new A());
c.f(new B());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?