filmov
tv
Java IQ #20 - equals() vs '=='. #javafullstackdevelopercourse #javainterviewquestions

Показать описание
In Java, == and the equals() method are used to compare objects, but they work differently and are used in different scenarios:
1. When used with primitive types (int, float, char, etc.), == compares the actual values of the variables.
2. When used with reference types (objects), == compares the memory addresses (references) of the objects.
3. The default implementation of the equals() method in the Object class compares memory addresses, similar to ==.
4. Many classes (like String, Integer, etc.) override the equals() method to compare the values of the objects instead of their references.
#javafullstackdevelopercourse #javacodinginterviewquestions #fullstackdevelopercoursewithplacement
For Java Full Stack Training & Placement,
View the full playlist on Java Interview Questions here
1. When used with primitive types (int, float, char, etc.), == compares the actual values of the variables.
2. When used with reference types (objects), == compares the memory addresses (references) of the objects.
3. The default implementation of the equals() method in the Object class compares memory addresses, similar to ==.
4. Many classes (like String, Integer, etc.) override the equals() method to compare the values of the objects instead of their references.
#javafullstackdevelopercourse #javacodinginterviewquestions #fullstackdevelopercoursewithplacement
For Java Full Stack Training & Placement,
View the full playlist on Java Interview Questions here