阅读背景:

使用Java中的反射创建一个新实例,并将引用变量类型设置为新实例类名?

来源:互联网 

All the examples I look at for reflection show creating a new instance of an unknown implementation, and casting that implementation to it's interface. The issue with this is that now you can't call any new methods (only overrides) on the implementing class, as your object reference variable has the interface type. Here is what I have:All the examples I look at for reflection show




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: