大家帮帮忙找找错误呀
inte易做图ce PCI{
void start();
void stop();
}
class NetWorkCard implements PCI
{
public void start()
{
System.out.println("Send...");
}
public void stop()
{
System.out.println("stop...");
}
}
class SoundCard implements PCI
{
public void start()
{
System.out.println("du..du");
}
public void stop()
{
System.out.println("sound stop");
}
}
class MainBoard
{
public void UsePCICard(PCI p)
{
p.start();
p.stop();
}
}
class Assembler
{
public static void main(String[] args)
{
MainBoard mb = new MainBoard();
NetWorkCard nc = new NetWorkCard();
SoundCard sc = new SoundCard();
//这行还有下面两行编译时一直报错,不知道怎么回事
mb.usePCICard(nc);
mb.usePCICard(sc);
[img=http://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/001/face/15.gif][/
mb.usePCICard(new PCI() //匿名内置类
{
public void start()
{
System.out.println("test start");
}
public void stop()
{
System.out.println("test stop");
}
});
}
} --------------------编程问答-------------------- public void UsePCICard你定义的是大写的U --------------------编程问答-------------------- 哈哈,Thankyou
--------------------编程问答-------------------- 很明显的错误,eclipse没有提示你吗? --------------------编程问答-------------------- 楼主我用eclipse 直接显示错误还提示转换成大写的。
你不会是小号吧
补充:Java , Eclipse