Java-new String vs String literals

new String vs String literals When you create String object using new¬†operator, it always create a new object in heap(one of memory section). On the other hand, if you create object using string literal, it may return an existing object from String pool(one of memory section), if it’s already exists. Otherwise it will create a … Read more…