遍历实体类属性
public static void main(String[] args) throws IllegalArgumentException, IllegalAccessException {
// TODO Auto-generated method stub
Person p=new Person(3,"阿三");
for (Field field :p.getClass().getDeclaredFields()) {
field.setAccessible(true);
System.out.println(field.getName() + ":" +field.get(p));
}
}