package w5进阶版; // 测试 public class TestUSB { public static void main(String[] args) { // 创建电脑对象 Computer myComputer = new Computer(); // 创建USB设备 USB mouse = new Mouse(); USB keyboard = new Keyboard(); // 插入不同设备 myComputer.useUSB(mouse); myComputer.useUSB(keyboard); } }