String method equals check if both references points objects with same values stored in them. Operator == check if both references points to same object.
public class Main { public static void main(String[] args) { String str1 = "Hello"; String str2 = new String("Hello"); System.out.println(str1.equals(str2)); System.out.println(str1 == str2); } }
true false