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
Can a method be static?
What is the difference between a static and a non-static inner class in java programming?
When arithmeticexception is thrown?
Why map is used in java?
When a thread is executing synchronized methods , then is it possible to execute other synchronized methods simultaneously by other threads?
Why put method is idempotent?
What is widening and narrowing in java? Discuss with an example.
Why singleton is not thread safe?
what is instanceof operator used in java?
what is optional in java 8?
What is variable and example?
What is the difference between interface & abstract class?
What are different exception types exceptions available in java ?
Explain thread life cycle in java?
What are the advantages of exception handling?