package com.king.common.util;
import java.lang.reflect.Field;
public class SystoutBean {
public static void outbean(Object e) throws IllegalArgumentException, IllegalAccessException{
Class cls = e.getClass();
Field[] fields = cls.getDeclaredFields();
for(int i=0; i<fields.length; i++){
Field f = fields[i];
f.setAccessible(true);
System.out.println("属性名:" + f.getName() + " 属性值:" + f.get(e));
}
}
}
将bean输出 等同于tostring