According to my teacher, String is like an array, it can not be resized once created. But how come you can modify a String like: String s = "abc"; s += "-" + "def"; This is confusing me.
Once the reference to the String has been lost there is no way to recall it.
However, since the String is still there, when you assign a new (identical) String, Java goes to the String pool, pulls it out , and uses it rather than creating a new identical String.
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Pretty clever, where do you learn all this stuff by the way? After posting the above I realized that my reply could be misinterpret I meant Java is pretty clever, but dont worry Marilyn I think you are too [This message has been edited by Johannes de Jong (edited April 24, 2001).]