76 402
Assignments Done
Successfully Done
In May 2019

Answer to Question #49979 in Other Engineering for Paul

Question #49979
In java how can we use the concept of stringbuilder
Expert's answer
If you use Stringconcatenation in a loop (something like:
String s ="";
for(int i = 0; i <100; i++) {
s += ", " + i;
then you should usea StringBuilder (not StringBuffer)instead of a String, because it is much faster and consumes less memory.
If you have a singlestatement:
String s = "1," + "2, " + "3, " + "4, " ....;
then you can useStrings, because the compiler will use StringBuilder automatically.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions