Is there any equivalent syntax for C# Type.GetType() in java

后端 未结 2 2030
[愿得一人]
[愿得一人] 2021-01-17 01:17

Please let me know Is there any equivalent syntax for C# Type.GetType() in java.

And equivalent syntax of Activator.CreateInstance() in jav

2条回答
  •  生来不讨喜
    2021-01-17 01:41

    You might achieve something like using Java reflection

    Class c - object.getClass();
    
    object.getClass().getConstructors()[0].newInstance(initargs);
    

提交回复
热议问题