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 meant by Garbage collection?
What are the advantages of compiled language?
What do you understand by the term string pool?
Can we extend immutable class?
What is arraylist e?
What is "this" keyword in java? Explain
Why java is secure? Explain.
What is are packages?
Can we overload run() method in java?
Can a final variable be null?
What is Classloader in Java?
What do you mean by default constructor in java?
What is the importance of finally block in exception handling?
Difference between start() and run() method of thread class?
What are 4 pillers of object orinted programming?