【发布时间】:2012-12-30 05:20:23
【问题描述】:
这是一个例子:
// set up frame, panel
JFrame container = new JFrame("Game Example");
panel = (JPanel)container.getContentPane();
我检查了 Java API 并且两个类都实现了相同的接口,所以这和多态性是原因吗?
还是因为这两个类都是通过继承从Component类继承而来的?
【问题讨论】:
标签: java inheritance interface casting polymorphism