单选题Which methods from the String and StringBuffer classes modify the object on which they are called?()A The charAt() method of the String class.B The toUpperCase() method of the String class.C The replace() method of the String class.D The reverse() meth

题目
单选题
Which methods from the String and StringBuffer classes modify the object on which they are called?()
A

The charAt() method of the String class.

B

The toUpperCase() method of the String class.

C

The replace() method of the String class.

D

The reverse() method of the StringBuffer class.

E

The length() method of the StringBuffer class.


相似考题
更多“Which methods from the String and StringBuffer classes modif”相关问题
  • 第1题:

    Which two are true?()

    • A、 An encapsulated, public class promotes re-use.
    • B、 Classes that share the same interface are always tightly encapsulated.
    • C、 An encapsulated class allows subclasses to overload methods, but does NOT allow overriding methods.
    • D、 An encapsulated class allows a programmer to change an implementation without affecting outside code.

    正确答案:A,D

  • 第2题:

    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

  • 第3题:

    关于 String、StringBuffer 和 StringBuilder 说法错误的是()

    • A、String 创建的字符串是不可变的
    • B、StringBuffer 创建的字符串是可变的,而所引用的地址一直不变
    • C、StringBuffer 是线程安全的,因此性能比 StringBuilder 好
    • D、StringBuilder 没有实现线程安全,因此性能比 StringBuffer 好

    正确答案:B

  • 第4题:

    关于String和StringBuffer,下面那些是正确的:()

    • A、常量字符串使用String,非常量字符串使用StringBuffer。
    • B、使用StringBuffer的时候设置初始容量。
    • C、尽量使用StringTokenizer代替indexOf()和substring()。
    • D、尽量不要使用StringBuffer,StringTokenizer类。

    正确答案:A,B,C

  • 第5题:

    String类和StringBuffer类的区别是什么?StringBuffer类提供了哪些独特的方法?


    正确答案:S.tring类的内容一旦声明则不可修改,而StringBuffer类的内容定义之后可以修改。StringBuffer类使用append()方法可以完成字符串的连接操作,而String类使用“+”完成。
    特殊方法:insert()、reverse()、replace()。

  • 第6题:

    关于String,StringBuilder以及StringBuffer,描述错误的是()。

    • A、对String对象的任何改变都不影响到原对象,相关的任何change操作都会生成新的对象
    • B、StringBuffer是线程安全
    • C、StringBuilder是线程安全
    • D、可以修改StringBuilder和StringBuffer的内容

    正确答案:C

  • 第7题:

    Which methods from the String and StringBuffer classes modify the object on which they are called?()  

    • A、The charAt() method of the String class.
    • B、The toUpperCase() method of the String class.
    • C、The replace() method of the String class.
    • D、The reverse() method of the StringBuffer class.
    • E、The length() method of the StringBuffer class.

    正确答案:D

  • 第8题:

    问答题
    举例说明String和StringBuffer的区别和应用场合。

    正确答案: S.TRING的长度是不可变的,STRINGBUFFER的长度是可变的。如果你对字符串中的内容经常进行操作,特别是内容要修改时,那么使用StringBuffer,如果最后需要String,那么使用StringBuffer的toString()方法
    使用StringBuffer主要就是在性能上的考虑。String是一种非常常用的数据类型,但由于String是不可变对象,在进行String的相关操作的时候会产生许多临时的String对象。而StringBuffer在操作上是在一个缓冲中进行的,性能当然优越得多。不过,一般做为简单的字符串传递和其它操作,只不要改变字符串内容的操作,用String效率会高一些。
    解析: 暂无解析

  • 第9题:

    单选题
    Which methods from the String and StringBuffer classes modify the object on which they are called?()
    A

    The charAt() method of the String class.

    B

    The toUpperCase() method of the String class.

    C

    The replace() method of the String class.

    D

    The reverse() method of the StringBuffer class.

    E

    The length() method of the StringBuffer class.


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

  • 第10题:

    多选题
    Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()
    A

    When using versions of Java technology earlier than 5.0.

    B

    When sharing a StringBuffer among multiple threads.

    C

    When using the java.io class StringBufferInputStream.

    D

    When you plan to reuse the StringBuffer to build more than one string.


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

  • 第11题:

    问答题
    String和StringBuffer类有什么区别

    正确答案: String类是不可变类,即字符串值一旦初始化后就不可能改变。StringBuffer是可变字符串类,类似String的缓冲区,可以修改字符串的值
    解析: 暂无解析

  • 第12题:

    单选题
    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
    解析: 暂无解析

  • 第13题:

    举例说明String和StringBuffer的区别和应用场合。


    正确答案: S.TRING的长度是不可变的,STRINGBUFFER的长度是可变的。如果你对字符串中的内容经常进行操作,特别是内容要修改时,那么使用StringBuffer,如果最后需要String,那么使用StringBuffer的toString()方法
    使用StringBuffer主要就是在性能上的考虑。String是一种非常常用的数据类型,但由于String是不可变对象,在进行String的相关操作的时候会产生许多临时的String对象。而StringBuffer在操作上是在一个缓冲中进行的,性能当然优越得多。不过,一般做为简单的字符串传递和其它操作,只不要改变字符串内容的操作,用String效率会高一些。

  • 第14题:

    String与StringBuffer的区别()。

    • A、String是不可变的对象,StringBuffer是可以再编辑的
    • B、String是常量,StringBuffer是变量
    • C、String是可变的对象,StringBuffer是不可以再编辑的
    • D、以上说法都不正确

    正确答案:A,B

  • 第15题:

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

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

    正确答案:D

  • 第16题:

    STRING与STRINGBUFFER的区别是什么?


    正确答案:STRING的长度是不可变的,STRINGBUFFER的长度是可变的。如果你对字符串中的内容经常进行操作,特别是内容要修改时,那么使用StringBuffer,如果最后需要String,那么使用StringBuffer的toString()方法。

  • 第17题:

    Which access methods can CS-MARS use toget configuration information from an Adaptive SecurityAppliance (ASA)? ()

    • A、 SDEE
    • B、 Telnet
    • C、 Console
    • D、 FTP
    • E、 HTTPS
    • F、 SSH

    正确答案:B,F

  • 第18题:

    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

  • 第19题:

    多选题
    关于String和StringBuffer,下面那些是正确的:()
    A

    常量字符串使用String,非常量字符串使用StringBuffer。

    B

    使用StringBuffer的时候设置初始容量。

    C

    尽量使用StringTokenizer代替indexOf()和substring()。

    D

    尽量不要使用StringBuffer,StringTokenizer类。


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

  • 第20题:

    单选题
    String、StringBuffer都是(  )类,都不能被继承。
    A

    static

    B

    abstract

    C

    final

    D

    private


    正确答案: A
    解析:
    在Java中,字符串是作为对象出现的,由java.lang.String和java.lang.StringBuffer定义,分别用来处理长度不变可变字符串,这两类都被定义为final,final最终类指明该类不能有子类。

  • 第21题:

    多选题
    Which access methods can CS-MARS use toget configuration information from an Adaptive SecurityAppliance (ASA)? ()
    A

    SDEE

    B

    Telnet

    C

    Console

    D

    FTP

    E

    HTTPS

    F

    SSH


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

  • 第22题:

    单选题
    Which keyword can protect a class in a package from accessibility by the classes outside the package()。
    A

    private

    B

    protected

    C

    final

    D

    don’t use any keyword at all (make it default)


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

  • 第23题:

    问答题
    String类和StringBuffer类的区别是什么?StringBuffer类提供了哪些独特的方法?

    正确答案: S.tring类的内容一旦声明则不可修改,而StringBuffer类的内容定义之后可以修改。StringBuffer类使用append()方法可以完成字符串的连接操作,而String类使用“+”完成。
    特殊方法:insert()、reverse()、replace()。
    解析: 暂无解析

  • 第24题:

    填空题
    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.printIn (textString + textBuffer);    }   )   What is the output?()

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