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 do you understand by the bean persistent property?
What is a local, member and a class variable?
How do you compare arrays in java?
What is an array length?
how to create daemon thread in java?
What is the purpose of garbage collection in java?
Why parsing is done?
What is the benefit of inner / nested classes ?
What is a linkedhashmap java?
What invokes a thread's run() method in java programming?
Is java developer a good career?
Explain when we should make an instance variable private.
What is linkedlist in java?
How does a for loop work java?
What is casting in java programming?