//USB接口定义
public interface USB{
public void work();
public void insert();
}
//MP3 类实现了 USB接口
public class Mp3 implements USB{
private String brand;
public Mp3(){
brand="unknown";
}
public Mp3(String brand){
this.brand=brand;
}
public void work(){
System.out.println(brand+"mp3 is working...");
}
public void insert(){
System.out.println(brand+" mp3 is inserting...");
}
}
//printer 类实现了USB接口
public class Printer implements USB{
private String brand;
public printer(){
brand="unknown";
}
public printer (String brand){
this.brand=brand;
}
public void work(){
Sysem.out.println(brand+"Pinter is working...");
}
public void insert(){
Sysem.out.println(brand+"Pinter is inerting.."
}
}