How to compare Java Strings correctly
One of the most common bugs I’ve seen in Java programs is the use of the == operator to compare two String objects. Most of the time the result may be accurate but it is not always guaranteed.We need to understand the difference between == and the Object.equals method.