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;
//Pass null get empty string
System.out.print("6) Pass null and get back an Empty string >>>");
System.out.println("**" + ObjectUtils.toString(null) + "**");
}
}
class MyClass{
public String toString() {
return "toString Output";
}
}
|