步骤 5
使用 Shape 和 DrawAPI 类画出不同颜色的圆 。
BridgePatternDemo.java
public class BridgePatternDemo {public static void main(String[] args) {Shape redCircle = new Circle(100,100, 10, new RedCircle());Shape greenCircle = new Circle(100,100, 10, new GreenCircle());redCircle.draw();greenCircle.draw();}}步骤 6
验证输出 。
Drawing Circle[ color: red, radius: 10, x: 100, 100]Drawing Circle[ color: green, radius: 10, x: 100, 100]
推荐阅读
- ps里如何压缩大小20k,如何用ps将一寸照片改为2寸
- ps里面怎么做发光效果,如何用PS做物体发光效果
- 黑暗无比是成语吗,旷亮的近义词是旷大
- js如何抛出和捕获异常
- 这是一场试炼在第几集,迪亚波罗这是一场试炼出自第几集
- 这几个字,我又双叒叕记混了
- 蘑菇竟有这么多鲜为人知的秘密
- 湛江旅游攻略美食
- 说文解字羹的起源