Why can’t we use == to compare String objects?

There is no difference really. When you use == to compare objects, you’re comparing their memory addresses, not their values . In your example, doing b1 == b2 will return true because they are the same object.

Sizin İçin Seçtik  What is == vs ===?

Leave a Reply

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