to 楼上:name和className都是String型输入参数,是不可知的。 可能是我理解不对,大侠能否编写一小段代码?多谢
同意study_body(珍惜每一天)。public static Class forName(String className) throws ClassNotFoundExceptionReturns the Class object associated with the class or interface with the given string name.
to study_body(珍惜每一天) Class.forName(className).newInstance()是可以创建一个类的实例, 我想知道的是怎样使得name中存储的变量名和这个实例对应起来,多谢! 能否给个小程序?
可能是我理解不对,大侠能否编写一小段代码?多谢
throws ClassNotFoundExceptionReturns
the Class object associated with the class or interface with the given string name.
Class.forName(className).newInstance()是可以创建一个类的实例,
我想知道的是怎样使得name中存储的变量名和这个实例对应起来,多谢!
能否给个小程序?