1) What is the difference between == and equals() in Java?
- The
==
operator checks if two references point to the same object in memory. - The
equals()
method checks if two objects are logically equivalent based on their content or values. It can be overridden to provide custom comparison logic.