+ 2

when we compare String each others.... suppose we have declared two String variables when to use a.equal(b) and (a==b) ?????

1st Mar 2022, 7:35 AM
Davinder Kumar
Davinder Kumar - avatar
2 Respostas
+ 3
Use of .equal() method is the preferable way opposed to use of == operator whenever a comparison of content was the goal. The == operator checks whether the two String shares the same reference, not content.
1st Mar 2022, 7:49 AM
Ipang