public class StringPool { public static void main(String[] args) { // TODO Auto-generated method stub String str1 = "Hello"; String str2 = "hello"; //we are not comparing the contents of the strings, we are comparing the string reference if(str1 == str2) { System.out.println("str1 == str2"); } else { System.out.println("Str1 != str2"); } String str3 = new String("Hello"); String str4 = new String("hello"); if(str3 == str4) { System.out.println("str3 == str4"); } else { System.out.println("Str3 != str4"); } if(str3.equalsIgnoreCase(str4)) { System.out.println("str3 and str4 are same string"); }else { System.out.println("str3 and str4 are not same string"); } if(str3.compareTo(str4) == 0) { System.out.println("str3 and str4 are same string"); }else { System.out.println("str3 and str4 are not same string"); } String myName = "lizhen"; System.out.println("Hello " + myName); } }