Java String.equals method compares this string to the specified object. The result is true if and only if the argument is not null and is a String object that represents the same sequence of characters as this object.
/** * @author lautturi.com * Java example: */ public class Lautturi { public static void main(String[] args) { String str1 = "Hallo"; String str2 = "Hello"; String str3 = "Hello"; System.out.println(str1.equals(str2)); // prints false System.out.println(str2.equals(str3)); // prints true } }