JAVA编程题

JAVA编程题速求
2024-12-23 03:26:42
推荐回答(1个)
回答1:

package com.test.demo;public interface IUSBStorage {public void readMe();public void writeMe();}package com.test.demo;public class CellPhone implements IUSBStorage{public String hostNumber;//本机号public void call(String number){}public void takePicture(){}@Overridepublic void readMe() {// TODO Auto-generated method stub}@Overridepublic void writeMe() {// TODO Auto-generated method stub}}package com.test.demo;public class UDisk implements IUSBStorage{@Overridepublic void readMe() {// TODO Auto-generated method stub}@Overridepublic void writeMe() {// TODO Auto-generated method stub}}package com.test.demo;public class Computer {public static void main(String[] args) {IUSBStorage ud=new UDisk();ud. readMe();IUSBStorage cp=new CellPhone();cp.readMe();cp.writeMe();}}