Java tutorial
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; //one and three are different objects System.out.print("3) Check object references and not values >>>"); System.out.println(ObjectUtils.equals(one, three)); } } class MyClass { public String toString() { return "toString Output"; } }