Untitled
unknown
plain_text
7 months ago
899 B
2
Indexable
Never
public interface Punch{ void punchAction(); } public class SwordPunch implements Punch{ @Override public void punchAction(){ System.out.println("punch with sword"); } } public class UppercutPunch implements Punch{ @Override public void punchAction(){ System.out.println("do uppercut punch"); } } public interface Kick{ void kickAction(); } public class FlyingKick implements Kick{ @Override public void kickAction(){ System.out.println("do flying kick to opponent"); } } public class LowerKick implements Kick{ @Override public void kickAction(){ System.out.println("do low kick to opponent's leg"); } } public static void main(String[] args){ Player yoshimitsu = new Player(); yoshimitsu.pushCross(new FlyingKick()); yoshimitsu.pushTrianlge(new SwordPunch()); Player paul = new Player(); paul.pushCross(new FlyingKick()); paul.pushTrianlge(new UppercutPunch()); }
Leave a Comment