Want to write articles/new answer to be published in javapedia.net? Send in your article with your name to javatutorials2016@gmail.com!

Prev Next

Java / Strings

What is the difference between creating String object using new and String literals?

When a String object is created using String literals, JVM searches at the String pool to find if any other String object is stored already with the same value. If found, it returns the reference to that String object from String pool otherwise it creates a new String object with given value and stores it in the String pool.

When we use new operator, JVM creates the new String object but don’t store it into the String Pool or try to reuse the existing objects with same value.

❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...

Using String

Comments & Discussions