Bad code. It’s out there. Sometimes you can correct it – other times you cannot. I would like to share a one liner I came across the other day. Unfortunately I could not change it since it was in a file that I was not working on.
int x = 4;
String num = x + "";
Argh! Why not use Integer’s static toString method?
int x = 4;
String num = Integer.toString(x);