Method[] ms=c.getDeclaredMethods();
for(Method m:ms){
System.out.println("...........................................");
System.out.println("方法:"+m.toString());
System.out.println("\t方法名:"+m.getName());
int mod=m.getModifiers();
System.out.println("\t方法修饰符:"+Modifier.toString(mod));
System.out.println("\t方法参数列表:");
Class pts[]=m.getParameterTypes();
for(int i=0;i
Class class1=pts[i];
if(i!=0)
System.out.println(",");
System.out.println(class1);
}
System.out.println();
System.out.println("\t返回值类型:"+m.getReturnType());
}
Constructor[] cs=c.getDeclaredConstructors();
for(Constructor con:cs){
System.out.println("******************************************");
System.out.println("构造方法:"+con.toString());
System.out.println("方法名:"+con.getName());
int mod=con.getModifiers();
System.out.println("\t方法修饰符:"+Modifier.toString(mod));
System.out.print("\t方法参数列表:");
Class pts[]=con.getParameterTypes();
for(int i=0;i
Class class1=pts[i];
if(i!=0)
System.out.print(",");
System.out.println(class1);
}
System.out.println();
}
System.out.println("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@");
Class superClass=c.getSuperclass();
System.out.println("当前类的父类:"+superClass.toString());
System.out.println("##########################################");
public class User {
public String name;
public int age;
public static int total=100;
public User() {
// TODO 自动生成构造函数存根
super();
}
public User(String name,int age){
super();
this.name=name;
this.age=age;
}
public void setAll(String name,int age){
this.name=name;
this.age=age;
}
public static void showTotal(){
System.out.println("int static method showTotal,total= "+total);
}
@Override
public String toString() {
// TODO 自动生成方法存根
return "用户名:"+name+"\t密码:"+age;
}
}