Best way of concatenate String in java -
this question has reply here:
string concatenation: concat() vs + operator 10 answerswhat best way concatenate 2 strings in java. best performance , less memory usage. please help me..!
stringbuilder stringbuilder = new stringbuilder(firststring); stringbuilder.append(secondstring); string string = stringbuilder.tostring();
but according @a_horse_with_no_name next more efficient
stringbuilder sb = new stringbuilder(firststring.length() + secondstring.length()); sb.append(firststring); sb.append(secondstring); string string = sb.tostring();
java
No comments:
Post a Comment