String intern()

Intern() method available in String class is used to return the string from the String constant pool. This will reduce the problem of string duplicates in Java. Whenever we call intern() method of String on any string object, it first checks whether same string is already available in string pool. If it’s available in pool, […]

Share this article on

String constant pool

It is also called as String literal pool or String pool. As the name suggests, String constant pool is a pool of strings stored in a separate place within the Heap area. We all know that we can create strings using “new” or by directly defining value in double quotes. Whenever we create a string […]

Share this article on
< Previous Next >