Yes i understand its not handy to convert all the way through int and
string conversion... but i thought you where also referring to fx
System.out.println("int var is: "+intvar); being bad code...
While theoretically *ALL* + operations with Strings can be replaced
with StringBuffers, the StringBuffer.append() method and .toString() or
String.valueOf() methods, with no loss of performance, in practice
things like "int var is: " + intvar are good code. Things like "" +
intvar *ARE NOT GOOD CODE*, though. This is because "writing out" the
first (with a non-empty String literal) requires several method calls,
but "writing out" the second (with an empty String literal) only
requires one, so using the method call instead makes the code both
more intuitive *AND MORE EFFICIENT*.
--
/-- Joona Palaste (
[email protected]) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"The obvious mathematical breakthrough would be development of an easy way to
factor large prime numbers."
- Bill Gates