I am reading certification book and here I have faced with confusing problem. The book says that this line of code creates only one String object, but I think 2 objects are created. Am I right?
String summer = new String("Summer");
Doesn't the constant literal "Summer" created and placed in String constant Pool?
EDIT: Guys I'm getting confused I need exact answer. Here are different posts says both 1 object & 2 object is creating.
new String()will not create it again, because it's already there. The same reference will be used."Summer".equals(new String("Summer"));