String s1, s2, template; s1 = "moo"; s2 = "mooz".substring(0, 3); prn("String1: " + s1); prn("String2: " + s2); template = "Using [%s] Result: %s%n"; prnf(template, "==", (s1 == s2)); prnf(template, "equals", (s1.equals(s2)));
String1: moo String2: moo Using [==] Result: false Using [equals] Result: true