diff --git a/compare.java b/compare.java new file mode 100644 index 0000000..5c0302f --- /dev/null +++ b/compare.java @@ -0,0 +1,13 @@ +public class ObjectComparisonExample +{ +public static void main(String[] args) +{ +//creating constructor of the Double class +Double x = new Double(123.45555); +//creating constructor of the Long class +Long y = new Long(9887544); +//invoking the equals() method +System.out.println("Objects are not equal, hence it returns " + x.equals(y)); +System.out.println("Objects are equal, hence it returns " + x.equals(123.45555)); +} +}