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


Please Help Members By Posting Answers For Below Questions

What is contract between hashcode and equal method?

582


What is linkedlist in java?

512


What is exception hierarchy in java?

593


What are examples of modifiers?

520


How can you share data between two thread in Java?

534






What is the scope or life time of instance variables?

665


What is java and their uses?

556


How many types of threads are there in java?

511


What is the public method modifier?

553


What are the various access specifiers in java?

571


What an i/o filter in java programming?

616


Is singleton class immutable?

546


What is currentthread()?

581


What is the most important feature of java? What is an interface?

526


What do you understand by final value?

596