Java Object Value Of valueOf(Object o)

Here you can find the source of valueOf(Object o)

Description

value Of

License

Open Source License

Declaration

public static String valueOf(Object o) 

Method Source Code

//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();
    }
}

Related

  1. valueOf(final Object o)
  2. valueOf(Object o)
  3. valueOf(Object o)
  4. valueOf(Object obj)
  5. valueOf(Object obj)
  6. valueOf(Object obj)
  7. valueOf(Object object)