有如下代码: StringBuffer buffer = new StringBuffer("Happy Birthday");buffer.insert(2, '5');System.out.println(buffer);则最后输出的结果是( )
A: Hap5py Birthday
B: H5appy Birthday
C: Ha5py Birthday
D: Ha5ppy Birthday
A: Hap5py Birthday
B: H5appy Birthday
C: Ha5py Birthday
D: Ha5ppy Birthday
D
举一反三
- 【单选题】def happy(): print("Happy birthday to you!") def happy_birthday(name): happy() print("Happy birthday, dear {}!".format(name)) happy() happy_birthday("teacher") A. Happy birthday to you! Happy birthday to you! Happy birthday, dear teacher! Happy birthday to you! B. Happy birthday to you! Happy birthday, dear teacher! Happy birthday to you! Happy birthday to you! C. Happy birthday to you! Happy birthday, dear teacher! Happy birthday, dear teacher! Happy birthday to you! D. Happy birthday to you! Happy birthday, dear teacher! Happy birthday to you!
- --Happy birthday!--______. A: Happy B: Happy birthday C: Thank you
- 5) To send off Mr. Stone, the students held a birthday party for him.
- ---Happy birthday!--______
- —Why didn’t you come to my birthday party yesterday?—____________ A: Excuse me, my friend sent me a flower. B: Sorry, but my wife had a car accident C: Ha…ha, Idon’t like birthday parties. D: Fine, Inever go to birthday parties.
内容
- 0
编写函数showMsg(n,name),它可以输出n行的字符串“Happy Birthday ***”,如果“***”为小明,则输出n行的“Happy Birthday 小明”
- 1
下列程序代码运行结果是:( )。StringBuffer buffer=new StringBuffer(); System.out.println(buffer.length()+" "+buffer.capacity()); A: 0 0 B: 0 16 C: 16 16 D: 16 0
- 2
Happy Birthday! Here is a gift for you. ____________________.
- 3
StringBuffer bf = new StringBuffer("0123456789");bf.insert(5, "abc");System.out.println(bf);//在控制台上输出。
- 4
---Happy New Year! A: It's OK B: Yes. C: The same to you. D: Happy birthday!