From 76f2b85bafc407dcd309897948ea37ae3b2ed380 Mon Sep 17 00:00:00 2001 From: SANGEETH SUBHASH <84234657+Sangeeth21@users.noreply.github.com> Date: Tue, 26 Oct 2021 20:58:25 +0530 Subject: [PATCH] Create compare.java --- compare.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 compare.java 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)); +} +}