Now get out of that bad habit of using String objects to perform operations on strings. With StringBuilder(introduced in J2Se 5.0), you can perform those very append and other such operations more efficiently.
Scene 1: typical coder…. using the same old String object to perform append operations.
String s = “Hello”;
s = s + ” World”;
system.out.println(s);
I agree it’ll give you “Hello World”, but fella…. let’s be different from the rest and think about making the code more efficient.
Enter Scene 2.
StringBuilder sb = new StringBuilder(“Hello”);
sb.append(” World”);
system.out.println(sb);
well… thats it!! You’ll get your “Hello World” but in a more efficient way
Thanks,Its very much informative and easy to get.
good answer..thanks
Good explanation .. nice
Easy example to differentiate string and string builder.. thanks..
good way to explain. thanks alot and keep it up.
Nicely and well explained about String, StringBuffer and StringBuilder. thanks
Glad you found it useful
nice explanation with example.
good exlanation, thanks
Its really useful and definitely a very practical explanation
it explain very well,it’s really easy to understand…
Very nice explaination of strings…i learnt it listening to music
Good way of explaining it,thanks
Nice.. it was informative, easy and useful. Thx.
Very good explanation, I am impressed.
Thank you..very useful
thanks for Explaining in a easy way
very simple and nice explanation thanks for that
Very good explanation.Thanks.
Easy to understanding,Thanks….
Thanks a lot. Was very useful