interface Advantage{
void show();
}
class Linux implements Advantage{
public void show(){
System.out.println("OpenSource");
}
}
class Windows implements Advantage{
public void show(){
System.out.println("Easy to use");
}
}
class Showadvt{
void showA(Advantage a){
a.show();
}
}
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Linux debian=new Linux();
Windows win10=new Windows();
Showadvt feature=new Showadvt();
feature.showA(debian);
feature.showA(win10);
}
}
输出如下Opensource
Easy to use