通过concat()方法进行字符串连接。


本文向大家介绍通过concat()方法进行字符串连接。,包括了通过concat()方法进行字符串连接。的使用技巧和注意事项,需要的朋友参考一下

您可以使用concat()String类的方法来连接两个字符串。此类将指定的字符串连接到该字符串的末尾。

示例

public class Test {
   public static void main(String args[]){
      String str1 = "Krishna";
      String str2 = "Kasyap";
      System.out.println(str1.concat(str2));
   }
}

输出结果

krishnaKasyap