Java String Manipulation Interview Questions with Answers - 1

Question: 1

What is string pool?

String Pool is a pool of strings stored in Java heap memory. We know that Strings is special class in java

 and we can create String object using new operator as well as providing values in double quotes.

Question: 2

Define immutable object?

An immutable object can’t be changed once it is created.

Question: 3

What is string subsequence method?

Java 1.4 introduced Char Sequence interface and String implements this interface, this is the only reason for the implementation of sub Sequence method in String class.

Internally it invokes the String substring method.

Question: 4

Why string buffer is called mutable?

The string class is considered as immutable; so that once it is created a String object cannot be changed.

If there is a necessity to make a lot of modifications to Strings of characters then StringBuffer should be used.

Related Questions