Java中连接字符串的最佳方法
Java中连接字符串的最佳方法是concat()方法。
此方法将一个String追加到另一个String之后。此方法返回一个String,其值是传递进此方法的String,追加到本方法调用的字符串的末尾。
示例
public class Test {
public static void main(String args[]) {
String s = "Strings are immutable";
s = s.concat(" all the time");
System.out.println(s);
}
} 输出
Strings are immutable all the time
广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C编程
C++
C#
MongoDB
MySQL
Javascript
PHP