[[don_t_use_new_string(...)]] Programming Don'ts

Route:

Using new String(...) is always a bad idea. It's basically like saying, "Please, make me a new String, even if you don't have to. I really want to use
more resources". Instead of using new String(...) you should use String.valueOf(...).

Once in a while, I'll see people literally do something like this: s = new String("Foo"); I suspect this may be the result of some refactoring oversight or
a novice at the keyboard (at least I hope so). This is pointless because you already have the string, you don't need to create a new one. This should
be changed to s = "Foo";
don_t_use_new_string(...), Rev. 1, Last changed on 2008-01-09 20:24, 138 page hits
Wiki hosted for free at wikihost.org || RSS-Feed || GeboGebo 1.3.3 || 00.216 seconds || || PAGERANK TOOLS