public interface IUSB {
int a= 1 ;
void start ( ) ;
void stop ( ) ;
}
public class Camera implements IUSB {
@Override
public void start ( ) {
System. out. println ( "The camera starts working..." ) ;
}
@Override
public void stop ( ) {
System. out. println ( "The camera stops." ) ;
}
}
public class Phone implements IUSB {
@Override
public void start ( ) {
System. out. println ( "The phone starts working..." ) ;
}
@Override
public void stop ( ) {
System. out. println ( "The phone stops." ) ;
}
}
public class Computer {
public void startUSB ( IUSB usb) {
usb. start ( ) ;
}
public void stopUSB ( IUSB usb) {
usb. stop ( ) ;
}
}
public class Main {
public static void main ( String[ ] args) {
Computer computer = new Computer ( ) ;
Camera camera = new Camera ( ) ;
Phone phone = new Phone ( ) ;
computer. startUSB ( camera) ;
computer. startUSB ( phone) ;
computer. stopUSB ( camera) ;
computer. stopUSB ( phone) ;
}
}