public class CharngArgs02 {
public static void main(String[] args) {
StringUtil s = new StringUtil();
String x = s.concat("hello","world","鸡勃","亚麻跌");
System.out.println(x);
}
}
class StringUtil{
public String concat(String...str){
String x ="";
for (int i =0;i<str.length;i++){
x += str[i];
x +=" ";
}
return x;
}
}
java简单输出
最新推荐文章于 2022-12-05 21:07:01 发布
本文提供了一个使用Java实现字符串拼接的简单示例。通过一个具体的程序代码展示了如何利用可变数量参数的方法来连接多个字符串。这个示例有助于理解Java中处理字符串的基本技巧。
518

被折叠的 条评论
为什么被折叠?



