Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
到目前为止,我找不到不需要 Constructor 类的方法。
此类在 Java ME 中不可用。
还有其他方法吗?
请注意,类的构造函数需要参数。
这是你想要的?
String className = "java.lang.String"; Class theClass = Class.forName(className); // this line will call the empty constructor String s = (String) theClass.newInstance();
http://docs.oracle.com/javame/config/cldc/ref-impl/midp2.0/jsr118/java/lang/Class.html#newInstance%28%29