• 2022-06-07
    有如下代码: 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
  • D

    内容

    • 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!