单选题字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer();  Integer intObj = new Integer(33);A strb1.append(3.14159);B strb1.append(’数’);C strb1.append(true);D strb1.append(intObj);

题目
单选题
字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer();  Integer intObj = new Integer(33);
A

strb1.append(3.14159);

B

strb1.append(’数’);

C

strb1.append(true);

D

strb1.append(intObj);


相似考题

1.本题中,用表格表现某个月的月历,其中标题是从Sunday到Saturday,表格中的各项是可以修改的。 import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.table.*; public class java2 ( public static void main(String[]args) { try{ UIManager.setLookAndFeel(UIManager.getSys- temLookAndFeelClassName): } catch(Exception e) JFrame. frame=new CalendarTableFrame; frame.setDefaultCloseOperation(JFrame.EXIT_ oN CLOSE); frame.show; } } clasgCalendarTableFrame. extends JFrame { private static final int WIDTH=500; private static final int HEIGHT=150: private cells= { {null,null,null,new Integer(1),new Integer (2),new Integer(3),new Integer(4)), {new Integer(5),new Integer(6),new Integer (7).new Integer(8),new Integer(9),new Integer (10),new Integer(11)), {new Integer(12),new Integer(13),new Integer (14),new Integer(15),new Integer(16),new Integer (17),new Integer(18)), {new Integer(19),new Integer(20),new Integer (21),new Integer(22),new Integer(23),new Integer (24),new Integer(25)), {new Integer(26),new Integer(27),new Integer (28),new Integer(29),new Integer(30),new Integer (31),null} }; private String[]columnNames={ "Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday" }; public CalendarTableFrame{ setTitle("java2"); setSize(WIDTH,HEIGHT); JTable table=new ; getContentPane.add(new JScrollPane(table), BorderLayout.CENTER); } }

更多“单选题字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer();  Integer intObj = new Integer(33);A strb1.append(3.14159);B strb1.append(’数’);C strb1.append(true);D strb1.append(intObj);”相关问题
  • 第1题:

    下面是一段javabean程序,该程序的运行结果是( )。public class NullTest{public static void main(String[]?args){int M=0;String str=null;StringBuffer sb=new StringBuffer("=");sb.append(str);sb.append(M++);System.out.println(sb.toString( ));}}

    A.=null
    B.=null0
    C.=null1
    D.=nullM

    答案:B
    解析:
    本题考查学生对javabean程序的熟悉程度,尤其是数值类型数据和字符串类型数据的掌握情况。M是整型变量,其值为0,str是字符串,sb是字符串空间,其中存放字符“=”,append是字符串添加函数,M++为自增运算符,它的特点是先取M的值作为表达式的值,再进行自增运算。程序的运算过程是:先将null拼接到“=”的后面,得字符串“=null”,再将0作为字符拼接到“=null”的后面,得“=null0”,M自增为1,输出结果为:=null0。

  • 第2题:

    下列关于String类和stringBuffer类说法正确的有()。

    • A、String类是不可变类,一个String对象所包含的字符串内容永远不会被改变
    • B、如果对字符串中的内容经常进行操作,特别是内容要修改时,应使用StringBuffer
    • C、StringBuffer类是可变类,一个StringBuffer对象所包含的字符串内容可以被添加或修改
    • D、字符串缓冲区支持可变的字符串

    正确答案:A,B,C,D

  • 第3题:

    StringBuffer append(数值类型 t),参数t可以是boolean、int、char、float、double、long


    正确答案:正确

  • 第4题:

    11. public void genNumbers() {  12. ArrayList numbers = new ArrayList();  13. for (int i=0; i<10; i++) {  14. int value = i * ((int) Math.random());  15. Integer intObj = new Integer(value);  16. numbers.add(intObj);  17. }  18. System.out.println(numbers);  19. }  Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?() 

    • A、 Line 16
    • B、 Line 17
    • C、 Line 18
    • D、 Line 19
    • E、 The object is NOT a candidate for garbage collection.

    正确答案:D

  • 第5题:

    以下关于字符串函数的描述中,正确的是()

    • A、append函数用于在已有的字符串末尾添加新的内容
    • B、insert函数的作用是在字符串的某个位置插入一个字符
    • C、setCharAt函数的作用是将String或StringBuffer字符串的某个字符串替换
    • D、replace函数的作用是替换一段子串 E delete函数用语删除整个字符串

    正确答案:A,B,D

  • 第6题:

    Public class test (  Public static void stringReplace (String text)  (  Text = text.replace (‘j’ , ‘i’);  )  public static void bufferReplace (StringBuffer text)  (  text = text.append (“C”)  )   public static void main (String args[]}  (  String textString = new String (“java”); StringBuffer text BufferString = new StringBuffer (“java”);  stringReplace (textString);  bufferReplace (textBuffer);  System.out.printLn (textString + textBuffer);  ) )  What is the output?()


    正确答案:javajavaC

  • 第7题:

    String类的concat()方法与StringBuffer类的append()方法都可以连接两个字符串,它们之间有何不同?


    正确答案:String的concat()方法不改变原字符串本身,而是产生一个新的字符串。StringBuffer的append()方法则改变其中的字符串内容,而不产生一个新的对象。

  • 第8题:

    单选题
    Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  return buffer.toString();  }  Which is true?()
    A

     This code is NOT thread-safe.

    B

     The programmer can replace StringBuffer with StringBuilder with no other changes.

    C

     This code will perform well and converting the code to use StringBuilder will not enhance the performance.

    D

     This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;


    正确答案: B
    解析: 暂无解析

  • 第9题:

    填空题
    Public class test (  Public static void stringReplace (String text)  (  Text = text.replace (‘j’ , ‘i’);  )  public static void bufferReplace (StringBuffer text)  (  text = text.append (“C”)  )   public static void main (String args[]}  (  String textString = new String (“java”);  StringBuffer text BufferString = new StringBuffer (“java”);  stringReplace (textString);  BufferReplace (textBuffer);  System.out.printLn (textString + textBuffer);  )  )   What is the output?()

    正确答案: JAVAJAVA
    解析: 暂无解析

  • 第10题:

    单选题
    字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer();  Integer intObj = new Integer(33);
    A

    strb1.append(3.14159);

    B

    strb1.append(’数’);

    C

    strb1.append(true);

    D

    strb1.append(intObj);


    正确答案: C
    解析: 暂无解析

  • 第11题:

    单选题
    Given:   11. public void genNumbers() {   12. ArrayList numbers = new ArrayList();   13. for (int i=0; i<10; i++) { 14. int value = i * ((int) Math.random());   15. Integer intObj = new Integer(value);   16. numbers.add(intObj);   17. }   18. System.out.println(numbers);   19. }   Which line of code marks the earliest point that an object referenced by intObj becomes a  candidate for garbage collection?()
    A

     Line 19

    B

     The object is NOT a candidate for garbage collection.

    C

     Line 17

    D

     Line 16

    E

     Line 18


    正确答案: C
    解析: 暂无解析

  • 第12题:

    判断题
    StringBuffer append(数值类型 t),参数t可以是boolean、int、char、float、double、long
    A

    B


    正确答案:
    解析: 暂无解析

  • 第13题:

    字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer();  Integer intObj = new Integer(33);

    • A、strb1.append(3.14159);
    • B、strb1.append(’数’);
    • C、strb1.append(true);
    • D、strb1.append(intObj);

    正确答案:D

  • 第14题:

    String与StringBuffer最大的区别在于()

    • A、它们没有区别
    • B、String对原字符串的拷贝进行操作,而StringBuffer对原字符串本事操作
    • C、StringBuffer拥有更多相关函数
    • D、String更节省空间

    正确答案:D

  • 第15题:

    public static void main( String[] args ) {  Integer a = new Integer(10);  Integer b = new Integer(10);  Integer c = a;  int d = 10;  double e = 10.0;  }   Which three evaluate to true?()   

    • A、 (a == c)
    • B、 (d == e)
    • C、 (b == d)
    • D、 (a == b)
    • E、 (b == c)
    • F、 (d == 10.0)

    正确答案:A,B,F

  • 第16题:

    定义有StringBuffer s1=new StringBuffer(10);s1.append(“1234”)则s1.length()和s1.capacity()分别是多少?

    • A、4;10
    • B、4;4
    • C、10;10
    • D、10;4

    正确答案:A

  • 第17题:

    Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟<‟);  buffer.append(this.name);  buffer.append(‟>‟);  return buffer.toString();  }  Which is true?() 

    • A、 This code is NOT thread-safe.
    • B、 The programmer can replace StringBuffer with StringBuilder with no other changes.
    • C、 This code will perform well and converting the code to use StringBuilder will not enhance the performance.
    • D、 This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;

    正确答案:B

  • 第18题:

    public class SyncTest{   public static void main(String args) {    final StringBuffer s1= new StringBuffer();    final StringBuffer s2= new StringBuffer();    new Thread () {    public void run() {   synchronized(s1) {   s2.append(“A”);   synchronized(s2) {    s2.append(“B”);    System.out.print(s1);    System.out.print(s2);   }   }    }    }.start();   new Thread() {   public void run() {   synchronized(s2) {  s2.append(“C”);  synchronized(s1) {   s1.append(“D”);  System.out.print(s2);  System.out.print(s1);   }   }    }   }.start();   }   }   Which two statements are true? ()

    • A、 The program prints “ABBCAD”
    • B、 The program prints “CDDACB”
    • C、 The program prints “ADCBADBC”
    • D、 The output is a non-deterministic point because of a possible deadlock condition.
    • E、 The output is dependent on the threading model of the system the program is running on.

    正确答案:B,D

  • 第19题:

    以下语句的含义是() char[] arrcrlf={13,10};  String crlf=new String(arrcrlf);  stringBuffer dest = new StringBuffer("西行漫记");  dest.append(crlf); 

    • A、字符串"西行漫记"不变
    • B、字符串"西行漫记"的最后一个字被删除
    • C、语句存在语法错误
    • D、在字符串"西行漫记"的后面加回车换行符

    正确答案:D

  • 第20题:

    问答题
    String类的concat()方法与StringBuffer类的append()方法都可以连接两个字符串,它们之间有何不同?

    正确答案: String的concat()方法不改变原字符串本身,而是产生一个新的字符串。StringBuffer的append()方法则改变其中的字符串内容,而不产生一个新的对象。
    解析: 暂无解析

  • 第21题:

    多选题
    public static void main( String[] args ) {  Integer a = new Integer(10);  Integer b = new Integer(10);  Integer c = a;  int d = 10;  double e = 10.0;  }   Which three evaluate to true?()
    A

    (a == c)

    B

    (d == e)

    C

    (b == d)

    D

    (a == b)

    E

    (b == c)

    F

    (d == 10.0)


    正确答案: B,D
    解析: 暂无解析

  • 第22题:

    多选题
    以下关于字符串函数的描述中,正确的是()
    A

    append函数用于在已有的字符串末尾添加新的内容

    B

    insert函数的作用是在字符串的某个位置插入一个字符

    C

    setCharAt函数的作用是将String或StringBuffer字符串的某个字符串替换

    D

    replace函数的作用是替换一段子串 E delete函数用语删除整个字符串


    正确答案: B,D
    解析: 暂无解析

  • 第23题:

    单选题
    以下语句的含义是() char[] arrcrlf={13,10};  String crlf=new String(arrcrlf);  stringBuffer dest = new StringBuffer("西行漫记");  dest.append(crlf);
    A

    字符串西行漫记不变

    B

    字符串西行漫记的最后一个字被删除

    C

    语句存在语法错误

    D

    在字符串西行漫记的后面加回车换行符


    正确答案: C
    解析: 暂无解析

  • 第24题:

    多选题
    public class SyncTest{   public static void main(String args) {    final StringBuffer s1= new StringBuffer();    final StringBuffer s2= new StringBuffer();    new Thread () {    public void run() {   synchronized(s1) {   s2.append(“A”);   synchronized(s2) {    s2.append(“B”);    System.out.print(s1);    System.out.print(s2);   }   }    }    }.start();   new Thread() {   public void run() {   synchronized(s2) {  s2.append(“C”);  synchronized(s1) {   s1.append(“D”);  System.out.print(s2);  System.out.print(s1);   }   }    }   }.start();   }   }   Which two statements are true? ()
    A

    The program prints “ABBCAD”

    B

    The program prints “CDDACB”

    C

    The program prints “ADCBADBC”

    D

    The output is a non-deterministic point because of a possible deadlock condition.

    E

    The output is dependent on the threading model of the system the program is running on.


    正确答案: E,D
    解析: 暂无解析