publicclass JAVA_046
{
publicstaticvoid main(String[] args)
{
String String1="Too many ";
String String2="cooks";
String String3="Too many cooks";
String1+=String2;
System.out.println("Test # 1");
System.out.println("String3 is now : " + String3);
System.out.println("String1 is now : " + String1);
if(String1.equals(String3))
System.out.println("String1.equals(String3) is True, so Strings are equal");
else
System.out.println("String1.equals(String3) is False, so Strings are not equal");
String3="TOO many cooks";
System.out.println("\n\nTest # 2");
System.out.println("String3 is now : " + String3);
System.out.println("String1 is now : " + String1);
if(String1.equals(String3))
System.out.println("String1.equals(String3) is True, so Strings are equal");
else
System.out.println("String1.equals(String3) is False, so Strings are not equal");
if(String1.equalsIgnoreCase(String3))
System.out.println("String1.equalsIgnoreCase(String3) is True, " +
"so Strings are equal ignoring case");
else
System.out.println("String1.equalsIgnoreCase(String3) is False, " +
"so Strings are different");
}
}