java tutorial - String concatenation in Java - java programming - learn java - java basics - java for beginners
Learn java - java tutorial - How to perform string-concatenation - java examples - java programs
String concatenation:
- It is an operation of joining the character strings back-to-back.
- In this example, we will see how to concatenate Strings in Java.
- The String concatenation in Java can be done in numerous ways.
- Using + operator - while use + operator
string_1 + string_2
statement, then it will executed as, new StringBuffer().append(string_1 ).append(string_2) within it. - + operator is not recommended for huge number of String concatenation as the performance is not good.
- Using String.concat() method – concatenates the specified string to the end of this string.
- Using StringBuffer.append method - Appends the specified StringBuffer to this sequence.