Can we use == to compare strings in Java?

Example 2: Compare two strings using equals() To compare these strings in Java, we need to use the equals() method of the string. 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 .

Sizin İçin Seçtik  Nurofen Cold kaç gün içilir?

Leave a Reply

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