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 contract between hashcode and equal method?
What is linkedlist in java?
What is exception hierarchy in java?
What are examples of modifiers?
How can you share data between two thread in Java?
What is the scope or life time of instance variables?
What is java and their uses?
How many types of threads are there in java?
What is the public method modifier?
What are the various access specifiers in java?
What an i/o filter in java programming?
Is singleton class immutable?
What is currentthread()?
What is the most important feature of java? What is an interface?
What do you understand by final value?