Comparing two Strings s = “ja”.concat(“va”); and s1=s.intern(); with == operator returns false. Why?
问题 For Eg: When I compare two strings with == operator after I call intern() method it returns true. String name = "Wahab"; // in string literal pool String fullName = new String("Wahab"); // new string in heap String f = fullName.intern(); // pushing into string literal pool System.out.print(name == f); // **true** Using Concat and invoke intern(), == operator returns true. String name = "Wahab".concat("Shaikh"); // concat with new string String fullName = name.intern(); // invoke intern to