String Constant Pool

Java String Constant Pool

Learn about String class in Java, the motivation behind making it immutable, and the idea of a String constant pool. We will see how memory is manipulated when we create String instances via String literals or String constructors. Finally, we will go through the main advantages and disadvantages caused by the immutability of the String …

Java String intern()

Learn to intern a string, and how the string literals differ from string objects. Java String.intern() is a native method and performs fast.

Why are Strings Immutable in Java?

The immutable strings help in achieving the required data safety and performance in a Java application with help of underlying string pool.

About Us

HowToDoInJava provides tutorials and how-to guides on Java and related technologies.

It also shares the best practices, algorithms & solutions and frequently asked interview questions.