public interface Shape { public void outputShape(); } class Circle implements Shape { public void outputShape() { System.out.println("this is a circle... ...
public interface Shape { public void outputShape(); } class Circle implements Shape { public void outputShape() { System.out.println("this is a circle"); } } class Square implements Shape { public void outputShape() { System.out.println("this is a square"); } } class Triangle implements Shape { public void outputShape() { System.out.println("this is a triangle"); } } public class Strategy { public static void strategic(Shape S) { S.outputShape(); } public static void main(String[] args) { strategic(new Circle()); strategic(new Square()); strategic(new Triangle()); } }