Java 教程 Java concat() 方法

ray · 2022-05-26 23:59:41 · 热度: 9

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

语法

public String concat(String s)

参数

  • s -- 要连接的字符串。

返回值

返回连接后的新字符串。

实例

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

以上程序执行结果为:

码农教程:www.codercto.com

查看更多 Java String 类 相关内容

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册