public class CheckStrings { public static void main (String[] args) { String strA; // first object String strB; // second object strA = new String("different object, same characters"); strB = new String("different object, same characters"); if (strA == strB) System.out.println("This will NOT print"); if (strA.equals(strB)) System.out.println("This WILL print"); } }