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

Write a program to print count of empty strings in java 8?

534


difference between byte stream class and character stream class?

4081


I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?

689


What does \ mean in regex?

619


Given a singly linked list, how will you print out its contents in the reverse order? Can you do it with consuming any extra space?

603






What are the different data types in java?

530


Explain about data types?

571


What is the instance of an object?

548


Can we have try block without catch block?

580


Does treeset use compareto?

538


What do you mean by multithreaded program?

548


which class is the wait() method defined in? : Java thread

521


How is it possible in java programming for two string objects with identical values not to be equal under the == operator?

560


What is a get method?

530


Will set allow duplicates in java?

497