9)用StringBuilder类把上面的字符串数组重新组装成一个StringBuilder对象【调用.append()方法】,打印输出StringBuilder对象的字符串;
时间: 2024-05-12 08:17:28 浏览: 70
字符串、String类和StringBuilder类
代码如下:
```
String[] strArray = {"Java", "is", "a", "popular", "programming", "language"};
StringBuilder sb = new StringBuilder();
for (String str : strArray) {
sb.append(str).append(" ");
}
System.out.println(sb.toString());
```
输出结果为:
```
Java is a popular programming language
```
阅读全文