interface GunInterface {
public void shot();
}
class Bomber implements GunInterface {
public void shot() {
System.out.println(“Bombbb !?”);
}
}
class Bazuka implements GunInterface {
public void shot() {
System.out.println(“Bazuka”);
}
}
public class RefreshInterface {
public RefreshInterface() {
Bomber bomb = new Bomber();
Bazuka bazu = new Bazuka();
GunInterface gun = bomb;
gun.shot();
gun = bazu;
gun.shot();
((GunInterface) bomb).shot();
((GunInterface) bazu).shot();
}
public static void main(String [] argv) {
new RefreshInterface();
}
}