Can you use == to compare strings?

You should not use == (equality operator) to compare these strings because they compare the reference of the string, i.e. whether they are the same object or not. On the other hand, equals() method compares whether the value of the strings is equal, and not the object itself.

Sizin İçin Seçtik  How do you do case-insensitive string comparison?

Leave a Reply

Your email address will not be published. Required fields are marked *