hi,
anshul is right.
consider this code snippet:
public class
test {
public static void main(String argv[]){
String temp = "hello";
String str = temp + "world";
String str1 = "helloworld";
System.out.println(str==str1);// false
}
}
here, StringBuffer is used while concatenating and so str!=str1.
new StringBuffer().append(temp).append("world").toString().
"hello","world" and "helloworld"(str1) are created in the pool.
a StringBufer is created in the heap(str) and also its String representation.
so, three in the pool and two in the heap for the above code snippet.i think i am right.
thanx to all,
shanks