Java concat() 方法

Java  String类


concat() 方法用于将指定的字符串参数连接到字符串上。

语法

public String concat(String s)

参数

返回值

返回连接后的新字符串。

实例

public class Test {
	public static void main(String args[]) {
		String s = "Sou_xun_com教程:";
		s = s.concat("www.sou-xun.com");
		System.out.println(s);
	}
}

以上程序执行结果为:

Sou_xun_com教程:www.sou-xun.com

Java  String类