In Java, Objects.equals() method is used to check the equality between Strings.
Objects.equals() method checks for the null before calling .equals()
String s1="Hello";
String s2="Hello";
System.out.println(s1.equals(s2));
Output of this code will be true. If the Strings are not equal, Output will be false.