Einstein47
Programmer
Hey all,
I have a pretty simple question (but it is usually the simplest questions that have the most controversial answers). Which is better:
or
I have seen both in the code that I am maintaining (written by various contractors over the years), and I just got curious which is better or preferred. Is there a best practice for turning an int into a String?
Einstein47 (Starbase47.com)
“PI is like love - simple, natural, irrational, endless, and very important“
I have a pretty simple question (but it is usually the simplest questions that have the most controversial answers). Which is better:
Code:
int index = 5;
String indexStr = String.valueOf(index);
Code:
int index = 5;
String indexStr = index + "";
Einstein47 (Starbase47.com)
“PI is like love - simple, natural, irrational, endless, and very important“