Here you can find the source of valueOf(final Object o)
Parameter | Description |
---|---|
o | a parameter |
public static final String valueOf(final Object o)
//package com.java2s; public class Main { public static final String STR_EMP = ""; /**// w w w . j ava 2 s . c o m * * @param o * @return */ public static final String valueOf(final Object o) { return (o instanceof String) ? (String) o : (o == null ? "null" : o.toString()); } /** * * @param objs * @return */ public static String toString(final Object[] objs) { if (objs == null) { return STR_EMP; } final int len = objs.length; if (len == 0) { return STR_EMP; } final StringBuilder buf = new StringBuilder(len * 12); for (int i = 0; i < len - 1; i++) { buf.append(objs[i]).append(", "); } return buf.append(objs[len - 1]).toString(); } }