public class ToStringPRU{
public static String tostring(Object o) throws Exception{
Class c=o.getClass();
Field[] fl=c.getDeclaredFields();
String[] s=new String[fl.length];
for (int i = 0; i < s.length; i++) {
s[i]=""+fl[i].get(o);
}
String st ="";
for (int i = 0; i < s.length; i++) {
st+=s[i]+" ";
}
return st;
}
}
转载于:https://my.oschina.net/2892328252/blog/639294