Here you can find the source of valueOf(Object o)
public static String valueOf(Object o)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 BSI Business Systems Integration AG. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors://from ww w . j a v a 2 s . c o m * BSI Business Systems Integration AG - initial API and implementation ******************************************************************************/ public class Main { public static String valueOf(Object o) { if (o == null) { return ""; } if (o instanceof byte[]) { return new String((byte[]) o); } if (o instanceof char[]) { return new String((char[]) o); } return o.toString(); } }