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 (列表)
What is the term used for the character that separates tokens?(用于分隔符号的字符术语是什么?)
A. Tokenizer (分词器)
B. Delimiter (分隔符)
C. Whitespace (空格)
D. separator(分离器)