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
What does file separator do in java?
In how many ways we can create threads in java?
How to display all the prime numbers between 1 and 100
How to display all the prime numbers between 1 and n (n is the number, get the input from user)
Can you override static methods?
What are data types in programming?
Can a class have a static inner class?
Describe the Big-O Notation.
Explain about procedural programming language or structured programming language and its features?
How can we find the actual size of an object on the heap?
What is collection class in java?
What is isa relationship?
I want to control database connections in my program and want that only one thread should be able to make database connection at a time. How can I implement this logic?
Explain why wait(), notify() and notifyall() methods are in object class rather than in thread class?
Can we pass null as argument in java?