单选题:如下代码输出( )。
如下代码输出( )。
public class TestStringBuilder {
public static void main(String[] args) {
String s = "Hello";
StringBuilder buffer = new StringBuilder(s);
buffer.append(" World!");
System.out.println(buffer);
}
}
A.Hello
B.World!
C.Hello World!
D.无输出
答案:C
public class TestStringBuilder {
public static void main(String[] args) {
String s = "Hello";
StringBuilder buffer = new StringBuilder(s);
buffer.append(" World!");
System.out.println(buffer);
}
}
A.Hello
B.World!
C.Hello World!
D.无输出
答案:C