StringBuilder s = new StringBuilder("Hello
Mom");s.append(",I mean,Mother");
Response.Write(s.ToString());
String s = "Hello Mom";
s+ = ",I mean Mom";
Response.Write(s);
Which is faster ? which uses the most memory?
Answer Posted / parameswaran m
The StringBuilder one is slightly more efficient and uses
less memory. In practice, it is unlikely to make enough of a
difference to matter either way.
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
What is enhanced loop in java?
Does java allow default arguments?
What is the scope or life time of instance variables?
What is difference between printf and scanf?
What does a boolean method return?
What is bifunction in java?
What is command line argument in java?
Can a class be protected in java?
What are the rules for variable declaration?
Can a class be defined inside an interface?
Explain the advantages of packages in java?
What is google full form?
What is the difference between an inner class and a sub-class?
What is arraylist e in java?
What is the purpose of the wait(), notify(), and notifyall() methods in java programming?