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