/*
通过接口实现多态。
*/
public class GraphTest {
public static void main(String[] args) {
GraphTest e = new GraphTest();
e.print(new Circle(10));
e.print(new Rectangle(5, 4));
e.print(new Triangle(7));
}
public void print(Graph g) {
System.out.println(g.p());
System.out.prin
接上篇,通过接口实现多态,求三角形,矩形,圆周长面积
最新推荐文章于 2021-03-01 14:50:37 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)