String Concatenation in Java


Use + to concatenate strings. For better performance in loops, consider using StringBuilder.

Source Code

String firstName = "John";
String lastName = "Doe";
String fullName = firstName + " " + lastName;
System.out.println("Full Name: " + fullName);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments