String valueOf vs concatenation with empty string

后端 未结 10 1684
说谎
说谎 2020-11-27 05:05

I am working in Java code optimization. I\'m unclear about the difference between String.valueOf or the +\"\" sign:

int intVar = 1;         


        
10条回答
  •  再見小時候
    2020-11-27 05:50

    From the point of optimization , I will always prefer the String.valueOf() between the two. The first one is just a hack , trying to trick the conversion of the intVar into a String because the + operator.

提交回复
热议问题