Look at the following statement: (请看下列语句:)StringBuilder str = new StringBuilder(25);What will the StringBuilder constructor do? (StringBuilder构造函数将做什么?)
A. give the object, str, 25 bytes of storage and store spaces in them (给对象str,25字节的存储及其存储空间)
B. give the object, str, 25 bytes of storage and not store anything in them (给对象str,25字节的存储并不在其中存储任何东西)
C. give the object, str, 25 or more bytes of storage and store spaces in them(给对象str,25或更多字节的存储及其存储空间)
D. give the object, str, 0 bytes of storage (给对象str,0字节的存储)
查看答案
What would be the results of executing the following code? (下列代码的运行结果是?)StringBuilder str = new StringBuilder("Little Jack Horner "); str.append("sat on the ");str.append("corner");
A. The program would crash. (程序会崩溃)
B. str would reference "Little Jack Horner ". (str为“Little Jack Horner”)
C. str would reference "Little Jac Horner sat on the ". (str为“Little Jac Horner sat on the”)
D. str would reference "Little Jack Horner sat on the corner".(str为“Little Jack Horner sat on the corner”)
When using the StringBuilder class's insert method,you can insert: (使用StringBuilder类的insert方法时,可以插入:)
A. any primitive type (任何基本类型)
B. a String object(字符串对象)
C. a char array(一个字符数组)
D. All of the above
What will be the value of str after the following statements are executed? (执行下列语句后,str的值将是多少?)StringBuilder str =new StringBuilder("We have lived in Chicago, " +"Trenton, and Atlanta."); str.replace(17, 24, "Tampa");
A. We have lived in Tampa, Trenton, and Atlanta.
B. We have lived in Chicago, Tampa, and Atlanta.
C. We have lived in Tampa Trenton, and Tampa.
D. We have lived in Tampalanta.
Sometimes a string will contain a series of words or other items of data separated by spaces or other characters. In programming terms, items such as these are known as what?(有时,字符串将包含一系列单词或其他数据项,这些数据项由空格或其他字符分隔开来。在编程术语中,像这样的项目被称为什么?)
A. Tokens (符号)
B. Delimiters (分隔符)
C. Key characters (关键字符)
D. Lists (列表)