"ab" + 'c' // String + char
"ab" + "c" // String + String of single char
What is the difference between these expressions?
- Is there any impact on the performance?
- Is there any difference in behavior on different Java versions?
"ab" + 'c' // String + char
"ab" + "c" // String + String of single char
What is the difference between these expressions?
Using A + "B" is much slower than using A + 'B' based on this test result
Concatenate char literal ('x') vs single char string literal (“x”)
Test Result:
averageing to:
a+'B': 4608ms
a+"B": 5167ms