In Java, == is used for reference comparison (checking if two references point to the same object), while .equals() is used for value/content comparison (if two objects are logically equal).
Example:
String s1 = new String(“Hello”);
String s2 = new String(“Hello”);
System.out.println(s1 == s2); // false (different objects in memory)
System.out.println(s1.equals(s2)); // true (contents are same)