0
Is String Concatenation memory efficient?
Which is more memory efficient: Concatenating two Strings, or just having one String with both values in it? My code below gives an example of both cases. Thank you in advance. https://code.sololearn.com/cdqv4F5k2GWF/?ref=app
3 odpowiedzi
0
Of course creating less variables is more memory efficient so if you can have one string don't create two of them.
0
Ok, then what about
String x = “HelloWorld”;
String y = “Hello” + “World”;
Which is more efficient. x or y?
0
this is the same