Java6: adding char to string

Is it better to add char to string compared to adding string to string in java6.

Eg. The following two lines of code will run faster:

String str = "One" + '\"'

or

String str = "One" + """
+3
source share
1 answer

I assume that concatenating String to String will have slightly better performance, since they do not need to be converted to Character and calling the toString () method on it.

Java Language Specification:
15.18.1.1 String Conversion

String .
x T , :
• T , Boolean (x).
• T char, (x).
...

0

All Articles