String.valueOf(someVar) vs (“” + someVar) [duplicate]
问题 This question already has answers here : String valueOf vs concatenation with empty string (10 answers) Closed 3 years ago . I want to know the difference in two approaches. There are some old codes on which I'm working now, where they are setting primitive values to a String value by concatenating with an empty String "" . obj.setSomeString("" + primitiveVariable); But in this link Size of empty Java String it says that If you're creating a separate empty string for each instance, then