In Java, string equals() method compares the two given strings based on the data/content of the string. If all the contents of both the strings are same then it returns true. If any character does not match, then it returns false.
refer to:lautturi.comboolean java.lang.String.equals(Object anObject) 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. true if the given object represents a String equivalent to this string, false otherwise
example:
/**
* @author lautturi.com
* Java example: Check whether the strings are the same
*/
import java.util.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
public class Lautturi {
public static void main(String[] args) throws ParseException {
String str1 = "Hello";
String str2 = "hello";
str1.equals(str2);
}
}