toString

阅读更多
implements java.lang.Cloneable, java.io.Serializable


public String toString() {
		StringBuffer sb = new StringBuffer();
		try {
			Field[] fs = getClass().getDeclaredFields();
			for (Field f : fs) {
				f.setAccessible(true);
				sb.append(f.getName()).append("=").append(f.get(this)).append(" ");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return sb.toString();
	}

你可能感兴趣的:(toString)