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 | 2 No |
Post New Answer View All Answers
how to run ecllipse with jettyserver for windows environment using batch file
What is the method to declare member of a class static?
What exactly is a .class file?
Why java is considered dynamic?
What are the differences between string, stringbuffer and stringbuilder?
What are internal and external variables?
What are scriptlets?
What is string made of?
Why spring singleton is not thread safe?
What is a text string?
What is bubble sorting in java?
What is double data type?
State some advantages of java?
What is byte [] in java?
Define how does a try statement determine which catch clause should be used to handle an exception?