Difference between == and .equals() in Java:
== is used to compare the memory addresses of objects, while .equals() compares the contents of objects.
Example:
String str1 = new String("Hello");
String str2 = new String("Hello");
System.out.println(str1 == str2); // false (different memory addresses)
System.out.println(str1.equals(str2)); // true (same content)