I have refernced the following links
Garbage collection and Strings
http://www.xyzws.com/Javafaq/what-is-string-literal-pool/3
Questions about Java's String pool
Still have some doubts please help me
`public class StrPool
{
public static void main(String[] args)
{
String abc="hello";
String abcd="hello";
System.out.println(abc==abcd);
}
}
`
In the above example OP : true
So we can confirm that both object are refered from same String object Am clear about that.
`String abc="hello World";
String abcd="hello";
System.out.println(abc==abcd);`
This gives output : false
So String pool is carried out when two String object having same literal???
If So two object of String will created in String pool??
Why second output is false ???
I READ THAT String class is immutable
abc
and abcd
have different object reference then Immutable means
" First String object will created by JVM and give two reference to abc and abcd " Am i right???
Thank you very much........