创建一个USB接口(至少含有一个test方法),创建一个手机类(Phone) 来实现USB接口,并在main方法中调用实现的方法(实现的方法里可以任意输出内容)。
public interface USB {
void test();
}
public class Phone implements USB {
@Override
public void test() {
System.out.println("手机正在进行USB测试");
}
}
public class Main {
public static void main(String[] args) {
Phone phone = new Phone();
phone.test();
}
}