You should use the StringBuilder class.
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Some text");
stringBuilder.append("Some text");
stringBuilder.append("Some text");
String finalString = stringBuilder.toString();
In addition, please visit:
- "How Java optimize the code with StringBuilder?"
- "StringBuilder vs String concatenation in toString() in Java"
Top answer 1 of 5
115
You should use the StringBuilder class.
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("Some text");
stringBuilder.append("Some text");
stringBuilder.append("Some text");
String finalString = stringBuilder.toString();
In addition, please visit:
- "How Java optimize the code with StringBuilder?"
- "StringBuilder vs String concatenation in toString() in Java"
2 of 5
36
Use StringBuilder class. It is more efficient at what you are trying to do.
Videos
01:59
JAVA || How to append to a string - YouTube
05:43
Beginner Java - String Append - Lesson 26 - YouTube
04:24
Concatenating (Joining) Strings in Java - YouTube
01:56
String += vs. StringBuilder.append #java #shorts #coding #airhacks ...
11:32
String Concatenation In Java | Java Full Course From Scratch - YouTube
02:44
StringBuilder append() Method in Java With Examples - YouTube
W3Schools
w3schools.com › java › java_strings_concat.asp
Java Strings Concatenation
Java Examples Java Videos Java Compiler Java Exercises Java Quiz Java Code Challenges Java Practice Problems Java Server Java Syllabus Java Study Plan Java Interview Q&A ... The + operator can be used between strings to combine them.
Codecademy
codecademy.com › docs › java › stringbuilder › .append()
Java | StringBuilder | .append() | Codecademy
August 22, 2022 - The .append() method appends the string value of its argument to the StringBuilder. It returns a reference to the StringBuilder object. ... Looking for an introduction to the theory behind programming?
W3Schools
w3schools.com › java › ref_string_concat.asp
Java String concat() Method
Java Examples Java Videos Java ... System.out.println(firstName.concat(lastName)); ... The concat() method appends (concatenate) a string to the end of another string....
Tutorialspoint
tutorialspoint.com › java › lang › stringbuilder_append_string.htm
Java.lang.StringBuilder.append() Method
The java.lang.StringBuilder.append(String str) method appends the specified string to this character sequence.The characters of the String argument are appended, in order, increasing the length of this sequence by the length of the argument.
GeeksforGeeks
geeksforgeeks.org › java › java-string-concat-examples
Java String concat() Method with Examples - GeeksforGeeks
The concat() method in Java is used to append one string to another and returns a new combined string.
Published April 7, 2026
Medium
medium.com › @AlexanderObregon › beginners-guide-to-java-string-concatenation-1e2fbccda0bc
Beginner’s Guide to Java String Concatenation
March 26, 2024 - The concat() method is a part of the String class and offers a more explicit approach to string concatenation. This method takes a single string argument and appends it to the string it is called on, returning a new string as the result.
Naukri
naukri.com › code360 › library › append-method-in-java-stringbuilder-and-stringbuffer
Append() Method in Java StringBuilder & StringBuffer
September 29, 2025 - Almost there... just a few more seconds
GeeksforGeeks
geeksforgeeks.org › java › stringbuffer-append-method-in-java-with-examples
StringBuffer append() Method in Java with Examples - GeeksforGeeks
July 11, 2025 - public StringBuffer append(boolean ... value to be appended. Return Value : The method returns a reference to this object. Examples: Input: string_buffer = "I love my Country" boolean a = true Output: I love my Country true Below program illustrates the java.lang.StringBuff...
Tutorialspoint
tutorialspoint.com › java › lang › stringbuilder_append.htm
Java StringBuilder append() Method
The Java StringBuilder append() method appends the string representation of its various arguments to the sequence. This method is a part of the String concatenation technique to combine two or more strings in java.
Medium
amrsaeedhosny.medium.com › how-to-concatenate-strings-in-java-6387cfd73634
How to Concatenate Strings In Java? | by Amr Saeed | Medium
September 1, 2023 - The StringBuilder class is a class that implements the CharSequence interface in Java. It is the same interface the String class implements. StringBuilder class implements Serializable, Comparable, and CharSequence. As mentioned earlier, the StringBuilder is the mutable version of the string, which means that it allows modifying the content without creating new objects. That’s why the StringBuilder is more efficient when it comes to string operations. String message = new StringBuilder("He").append("ll").append("o!").toString();