public class MainBoard {
public void run()
{ System.out.println("MainBoard run");
}
public void useNetcard(NetCard c)
{ c.open();
c.close();
}
}
class NetCard
{ public void open()
{ System.out.println("netcard open");
}
public void close()
{ System.out.println("netcard close");
}
}
class DuoTaiDemon11
{
public static void main(String[] args )
{
MainBoard m=new MainBoard();
m.run();
m.useNetcard(new NetCard());
}
} |
|