Java: How to load a class (and its inner classes) that is already on the class path?

后端 未结 3 1210
我在风中等你
我在风中等你 2020-12-19 06:45

How can I load a class that is already on the class path, instantiate it, and also instantiate any inner classes defined within it?

EG:

public class          


        
3条回答
  •  独厮守ぢ
    2020-12-19 07:27

    Class.forName("your classname").newInstance().
    

    The inner classes will be instantiated only if the constructor instantiates them.

提交回复
热议问题