Friday, July 19, 2019

java - On what parameter '==' decides equality?




When we write the following code in Java:





object1 == object2;





on what basis does the operator '==' decide equality?


Answer




If object1 and object2 are reference types, then == checks if object1 and object2 are both references to the same object.



See 15.21 Equality Operators in the Java Language Specification for full details.


No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...