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 / prasanta khandai
Actually what happens if u add two strings like second one,
then internally it uses the String Builder to call the
append method to add and it converted into the strings again.
so first one is the faster as it appended right ways.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is pre increment and post increment in java?
What is the difference between preemptive scheduling and time slicing?
What are adapter classes?
Explain list interface?
How do you replace a string in java?
What is the requirement of thread in java?
Explain what is Marker interface?
What are the Main functions of Java?
How we can run a jar file through command prompt in java?
State the merge-sort principle and its time complexity.
What is cr keyboard?
How do you insert a line break?
What is number data type?
What does int [] mean in java?
What is the difference between Java1.4 and Java1.5