Java tutorial
public class Main { public static void main(String[] args) { String str1 = "java2s.com", str2 = "Java2s.com"; CharSequence cs = "java2s.com"; System.out.println("Method returns: " + str1.contentEquals("java2s.com")); System.out.println("Method returns: " + str1.contentEquals(cs)); System.out.println("Method returns: " + str2.contentEquals("12345")); } }