The +
operator can be used between strings to combine them. This is called concatenation:
String firstName = "John";
String lastName = "Doe";
System.out.println(firstName + " " + lastName);
Note that we have added an empty text (" ") to create a space between firstName and lastName on print.
You can also use the concat()
method to concatenate two strings:
String firstName = "John ";
String lastName = "Doe";
System.out.println(firstName.concat(lastName));
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!