Java String concat(String str) 方法

Java String 类


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

语法

public String concat(String s)

参数

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

返回值

返回连接后的新字符串。

实例

public class Test { 
     public static void main(String args[]) { 
         String s = "IT自习室:"; 
         s = s.concat("www.itzixishi.com");  
         System.out.println(s); 
     }
}

以上程序执行结果为:

IT自习室:www.itzixishi.com

Java String 类

本教程仅供参考学习,如用于商业带来的问题,本站概不负责。
关注公众号
关注公众号

©2020 IT自习室京ICP备20010815号