Understandng Objects.deepEquals

Understandng Objects.deepEquals

We understand how equals() method works. There is a more elaborate method deepEquals() which compares in depth details during comparison.
Basic usage is described below. Let us explore more using these as examples.

import java.util.Objects;

public class DeepEquals
   public static void main(String args[])
      DeepEquals deepEquals = new DeepEquals();
   private void proceed()
      System.out.println(“Objects.deepEquals(1,1): ” + Objects.deepEquals(1,1));
      System.out.println(“Objects.deepEquals(1,2): ” + Objects.deepEquals(1,2));
      System.out.println(“Objects.deepEquals(“abc”,”abc”): ” + Objects.deepEquals(“abc”,”abc”));
      System.out.println(“Objects.deepEquals(“aa”,”ab”): ” + Objects.deepEquals(“aa”,”ab”));


Expected output:

[root@mypc]# java DeepEquals
Getting handle of runtime Console
Got handle of runtime Console
You can now use runtimeConsole object to perform actions of your choice on



About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist