Math, asked by rajuanvoju8645, 1 year ago

Compare two strings returns different integer values

Answers

Answered by saivivek16
0

Answer:


Step-by-step explanation:

Now when you compare two Integer object using a == operator, Java doesn't compare them by value, but it does reference comparison. When means even if the two integer has the same value, == can return false because they are two different objects in the heap. That's why you should use equals() method to compare objects.

Similar questions