which class to use when concatenating
strings in a loop.

Answer Posted / narasimha

we any use the both classes String and StringBuffer.
but if we use StringBuffer it would be advatagebecase we
are going to create only one Object.if we use the String
class it is going to create the one for each itration.now
it up to you which one to use

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you create a null object?

506


What do you understand by classes in java?

551


How can we make string upper case or lower case?

593


How do you sort a string in java?

532


What is string in java with example?

479






What is array length in java?

521


Why do we use variables?

505


Can you pass functions in java?

563


Give differences between Quicksort & Mergesort. When should these sorts be used and what is their running time?

569


what is synchronization and why is it important? : Java thread

582


What is super keyword explain with example?

525


Where import statement is used in a java program?

606


Which keyword specify that a variable is effectively final ?

555


How to Sort Strings which are given in List and display in ascending order without using java api.

3752


Does garbage collection occur in permanent generation space in jvm?

600