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 / debapriya maity
The first one is faster
Second code snippets:3 objects are created
1:s = "Hello Mom"
2:,I mean Mom
3:Hello Mom,I mean Mom
| Is This Answer Correct ? | 5 Yes | 1 No |
Post New Answer View All Answers
Difference between overriding and overloading in java?
Write a program in java to establish a connection between client and server?
What's the base class in java from which all classes are derived?
Can singleton class be inherited in java?
Can we make constructors static?
Can classes declared using the abstract keyword cab be instantiated?
What is lazy initialization in java?
What is generic class?
Why there is no call by reference in java?
What is meant by class loader? How many types are there? When will we use them?
What is the difference between integer parseint and integer valueof?
Can we nested try statements in java?
What is canonical name in java?
What is difference between arraylist and list in java?
Does list allow duplicates in java?