Java Object Value Of valueOf(Object value)

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

Description

 1. 

License

Open Source License

Parameter

Parameter Description
value a parameter

Declaration

public static String valueOf(Object value) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w  ww .ja v  a 2  s.com
     * <pre>
     * 1. value is String: return value
     * 2. value is null: return null
     * 3. value is Object: return value.toString()
     * </pre>
     * @param value
     * @return
     * @author <a href="mailto:iffiff1@gmail.com">Tyler Chen</a> 
     * @since 2014-8-23
     */
    public static String valueOf(Object value) {
        if (value == null) {
            return null;
        }
        if (value instanceof String) {
            return (String) value;
        }
        return value.toString();
    }
}

Related

  1. valueOf(Object o)
  2. valueOf(Object obj)
  3. valueOf(Object obj)
  4. valueOf(Object obj)
  5. valueOf(Object object)
  6. valueOf(Object[] array)
  7. valueOf(Object[] oarray)