Strings are constant; their values cannot be changed after they are created. String buffers support mutable strings. Because String objects are immutable they can be shared.
The nice thing about Standards is that there are so many to choose from!
Originally posted by Jeffrey Hunter:
[CODE]
So, in the above case, "lostReference" will essentially be lost in memory (assuming no other references point to it), until the garbage man comes along and cleans it up.
here will be TWO String object in the heap??
and Will String objects in the heap be Garbage collected if there is no reference refer to them?
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|