package com.blogspot.na5cent; import java.util.Date; /** * * @author redcrow */ public class User { private String name; private float age; private Date birthday; public String getName() { return name; } public void setName(String name) { this.name = name; } public float getAge() { return age; } public void setAge(float age) { this.age = age; } public Date getBirthday() { return birthday; } public void setBirthday(Date birthday) { this.birthday = birthday; } }
package com.blogspot.na5cent; import java.lang.reflect.Method; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author redcrow */ public class Test { public static void main(String[] args) { try { Class c = Class.forName("com.blogspot.na5cent.User"); Method methods[] = c.getMethods(); for(Method m : methods){ System.out.println(m); } } catch (ClassNotFoundException ex) { Logger.getLogger(Test.class.getName()).log(Level.SEVERE, null, ex); } } }
ไม่มีความคิดเห็น:
แสดงความคิดเห็น