Java Program example to demonstrate String contentEquals method

Program

public class StringContentEquals
{
	public static void main(String[] args)
	{
		String str1 = "welcome to oodlescoop";
		String str2 = "welcome to oodlescoop";
		String str3 = "welcome to tutorials";
		System.out.print("Content of \"" + str1 + "\" and \"" + str2 + "\" equal: ");
		System.out.println(str1.contentEquals(str2));
                System.out.print("Content of \"" + str1 + "\" and \"" + str3 + "\" equal: ");
		System.out.println(str1.contentEquals(str3));
	}
}

Output

Content of "welcome to oodlescoop" and "welcome to oodlescoop" equal: true
Content of "welcome to oodlescoop" and "welcome to tutorials" equal: false