import org.apache.commons.lang.ObjectUtils;
public class MainClass {
public static void main(String[] args) {
//Create ObjectUtilsTrial instance
MyClass one = new MyClass();
MyClass two = one; //Same Reference
MyClass three = new MyClass(); //New Object
MyClass four = null;
//Object details displayed..toString is not called
System.out.print("5) Display object details >>>");
System.out.println(ObjectUtils.identityToString(one));
}
}
class MyClass{
public String toString() {
return "toString Output";
}
}
5) Display object details >>>MyClass@b89838
Download: CommonLangObjectUtils.identityToString.zip( 199 k)