Java Puzzle–Immutable String
what will be output of the following program ?
1: class StringTest22: {3: public static void main(String[] args)4: {5: String str1 = "Hello";6: String str2 = "HELLO";7: String str3 = str1.toUpperCase();8: String str4 = str2.toUpperCase();9: System.out.println(str1 == str3);10: System.out.println(str2 == str4);11: }12: }
false
ReplyDeleteTrue