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 / ravi jain
First one is faster
because in 1st only one object is created,
but in 2nd one three objects are created.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What comes to mind when someone mentions a shallow copy in java?
What are the problems faced by java programmers who don't use layout managers?
Can inner class extend any class?
How can we avoid including a header more than once?
What is the best way to findout the time/memory consuming process?
What is difference between classpath and path variables in java?
What are thread priorities and importance of thread priorities in java?
Write a java program to count the number of words present in a string?
Discuss different types of errors that generally occur while programming.
Difference between static binding and dynamic binding?
Why use string handling in Java?
What is the major difference between linkedlist and arraylist?
How many types of gc are there in java?
What is byte value?
What will happen if there is a default method conflict as mentioned above and we have specified the same signature method in the base class instead of overriding in the existing class ?