Couple of points...
1) The Java doesn't define a specific garbage implementation. Anyone who create a JVM is free to create their own Garbage Collection implementation, as long as it conforms to the language standard.
2) A possible reason why "String.valueOf(message).append(foo)..." is always used instead of the few cases where "message.concat(foo)" might be better:
Anyone can write their own core class libraries and distribute it with their own JVM => JRE
So if I write a String class, which contains a valueOf(object) method, and a concat(object) method, I might rely on the fact that when String literal values are appended, the valueOf() mehtod is called, and not the concat() method.
Is it likely that someone would rely on this? Who knows. If you read Raymond Chen, it looks like a lot of Win32 API programmers rely on weird, undocumented, non-standard features of that API. At least there is some consistency with Sun's implementation.
And as a previous poster mentioned, freeing these short lived objects has a minor overhead. (creating lots of objects means that the garbage collector has to run more often, even if freeing the objects themselves has no overhead).
T
thebilliardplayer
@thebilliardplayer
0
Reputation
1
Posts
9
Profile views
0
Followers
0
Following
Best posts made by thebilliardplayer
This user hasn't posted anything yet.
Latest posts made by thebilliardplayer
-
RE: String.valueOf(String string)