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
Is an object null?
What is static and final keyword in java?
Can we have any code between try and finally blocks?
Difference between current previous versions of Java?
What is thread start?
Which collection allows duplicate values in java?
Can a private method be declared as static?
Are arrays immutable in java?
Is map ordered in java?
How to make a write-only class in java?
What is used of static keyword in java?
If I don't provide any arguments on the command line, then what will the value stored in the string array passed into the main() method, empty or null?
How we can run a jar file through command prompt in java?
What is the numeric promotion?
What is continuity of a function?