String.contentEquals(CharSequence cs) has the following syntax.
public boolean contentEquals(CharSequence cs)
In the following code shows how to use String.contentEquals(CharSequence cs) method.
public class Main { // w ww.j a va 2 s .c o m 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")); } }
The code above generates the following result.