目录

concat()

将指定的String连接到此String的末尾。

语法 (Syntax)

String concat(String str)

参数 (Parameters)

str - 连接到此String末尾的String。

返回值 (Return Value)

此方法返回一个字符串,该字符串表示此对象的字符串联,后跟字符串参数的字符。

例子 (Example)

以下是此方法的使用示例 -

class Example {
   static void main(String[] args) {
      String s = "Hello ";
      s = s.concat("World");
      System.out.println(s);
   } 
}

当我们运行上述程序时,我们将得到以下结果 -

Hello World
↑回到顶部↑
WIKI教程 @2018