This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Blue implements DrawAPI { | |
@Override | |
public void draw() { | |
System.out.print("blue"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Red implements DrawAPI { | |
@Override | |
public void draw() { | |
System.out.print("red"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface DrawAPI { | |
public void draw(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class Shape { | |
protected DrawAPI drawAPI; | |
protected Shape(DrawAPI drawAPI){ | |
this.drawAPI = drawAPI; | |
} | |
public abstract void draw(); | |
} |
NewerOlder