I know that String.valueOf(int) enables caching and often does not cause an extra object to be created, but does ("" + 1) get some kind of compiler optimization?
Which one should be used?
EDIT: String.valueOf(int) does not enable caching, Integer.valueof(int) does.
"" + 1is a bad habit in my opinion and as far as I know it is not optimized in any way.Do stick with
String.valueOf(int).