You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
462 B
18 lines
462 B
package w5进阶版;
|
|
|
|
// 电脑
|
|
public class Computer {
|
|
// 使用USB设备的方法(多态参数)
|
|
public void useUSB(USB usb) {
|
|
System.out.println("\n电脑开始使用USB设备...");
|
|
usb.open();
|
|
// 模拟工作
|
|
try {
|
|
Thread.sleep(500);
|
|
} catch (InterruptedException e) {
|
|
e.printStackTrace();
|
|
}
|
|
usb.close();
|
|
System.out.println("USB设备使用完毕\n");
|
|
}
|
|
}
|