Which is the best way to use for String concatenation in
Java?

Answer Posted / leo zhao

Hi Manasa,

You can use append to concatenate more than 2 strings, such as

StringBuffer str = new StringBuffer("Stanford ");
str.append("Lost!!").append(" again.");

Is This Answer Correct ?    18 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why singleton is not thread safe?

804


What is the properties class in java programming?

762


What is the static method?

771


Is a method a procedure?

787


Can an arraylist be empty?

797


What is not thread safe?

768


Can we define constructor in inner class?

772


Can we override data members in java?

904


Explain the difference between collection api and stream api in java8?

746


How do you use parseint in java?

741


What is connection class in java?

752


Can we create more than one object singleton class?

828


Which is faster call by value or call by reference?

715


How do you declare an empty string?

871


State one difference between a template class and class template.

860