本帖最后由 仲伟 于 2013-5-13 13:01 编辑
public class ClassMain {
public static void main(String[] args) {
new ClassMain().childGrow();
}
public void childGrow(){
Person p;
p=Person.Student;
p.grow();
}
}
import java.lang.reflect.Constructor;
public enum Person {
Student("aa");
private String name;
private Person(String name){
this.name = name;
}
@SuppressWarnings("unchecked")
public void grow(){
System.out.println("222");
Constructor[] constructors= Person.class.getConstructors();
for (Constructor constructor : constructors) {
System.out.println(constructor.getName());
Class[] paramters=constructor.getParameterTypes();
for (Class paramter : paramters) {
System.out.println(paramter.getName()+"111");
}
}
}
}
我的构造类型和参数不能输出来
|