-
Converting to String
String class provides us with the method String.valueOf(some stuff) that basically converts "some stuff" into a string..
But we can also concatenate "some stuff" with an empty String ("").
Both these methods result in a String representation of an object(or other data type) so my question is what is the difference between the two, advantages of one over the other, disadvantages of one over the other and which method do you guys usually use when forced to convert something to a String and why??
-
The API documentation of valueOf() describes what it does: but note that there are various versions that take different argument types.
String concatenation/conversion is dealt with in the JLS 15.18.1.
If this is a homework question your best bet is to read what these things actually do, then decide and express your own ideas and preferences for comment.