Remember that whenever a string literal is encountered,
it is put in the pool, if it is already in the pool then that
object(the one in the pool) is reused as it is.
eg String s1="abc";// means check if a String "abc" is in the pool
// if it is reuse it, if not create a new
// String object with the value "abc"
// and put it in the pool
String s2 = new String("abc");// whenever u use the new operator
// a new object is created regardless
// if it exists in the pool
as Strings are immutable, all the string functions
(in the case of the ques) always return a new String.they use a new
String s3 = s1.substring(4,7);// the pool is never used here.
Moral of the story is, pool is used only in case of String literals.
I hope this makes things more clear.