开发者

Loading a class by its name MyClass.class - is this possible?

It is possible to load a class given a String and its name? ie "MyClass.class"

Further, is it possible to pass parameters to the开发者_高级运维 constructor using this method?


Have a look at Construct Object using class name.

Key methods being forName() and newInstance().


Yes, look up the Reflection API.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜