class Shengka implements PCI
{
public void powerOn(){}
public void swapData(){}
public void pluge()
{
System.out.println("声卡安装到了电脑上");
}
}
class MainBoard
{
void usePCI(PCI p)
{
p.pluge();
}
}
public class ZhuBan{
public static void main(String[] args)
{
MainBoard m=new MainBoard();
PCI s=new Shengka();
m.usePCI(s);
m.usePCI(
new PCI()
{public void powerOn(){}
public void swapData(){}
public void pluge()
{
System.out.println("网卡安装到了电脑上");
}
}
);
}
}
Exception in thread "main" java.lang.NoSuchMethodError: en.itcast.java.tools.MainBoard.usePCI(Len/itcast/java/tools/PCI;)V
at en.itcast.java.tools.ZhuBan.main(ZhuBan.java:39)