Here you can find the source of objectToString(Object o)
Object.toString
on an object even if toString()
was overridden.
Parameter | Description |
---|---|
o | Object. |
o.toString()
with the Object.toString()
version of the method, or "null" if o
is null
.
public static String objectToString(Object o)
//package com.java2s; // it under the terms of the GNU Lesser General Public License as published public class Main { /**//from w w w .ja v a 2 s.c om * Emulate <code>Object.toString</code> on an object even if <code>toString()</code> was * overridden. * * @param o Object. * * @return A string similar to <code>o.toString()</code> with the <code>Object.toString()</code> * version of the method, or "null" if <code>o</code> is <code>null</code>. */ public static String objectToString(Object o) { if (o == null) return "null"; return o.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(o)); } }