0
what is the difference between == ans equals
3 Respuestas
+ 2
Main difference between == and equals in Java is that "==" is used to compare primitives while equals() method is recommended to check equality of objects.
Another difference between them is that, If both "==" and equals() is used to compare objects then == returns true only if both references points to same object while equals() can return true or false based on its overridden implementation.
One of the popular cases is comparing two String in Java in which case == and equals() method return different results.
+ 1
please any example
- 1
== means that 2 objects are exactly the same . eqauls means the content is the same. Int are compared by = and strings fir example with equals.