Given: 22.StringBuilder sb1 = new StringBuilder("123"); 23.S

题目
单选题
Given: 22.StringBuilder sb1 = new StringBuilder("123"); 23.String s1 = "123"; 24.// insert code here 25.System.out.println(sb1 + " " + s1); Which code fragment, inserted at line 24, outputs "123abc 123abc"?()
A

sb1.append(abc); s1.append(abc);

B

sb1.append(abc); s1.concat(abc);

C

sb1.concat(abc); s1.append(abc);

D

sb1.concat(abc); s1.concat(abc);

E

sb1.append(abc); s1 = s1.concat(abc);

如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Kevin had learnt something._____,he had given men new pride.

A.However

B.Nevertheless

C.Moreover

D.Although


答案:C

第2题:

Given that the current directory is empty, and that the user has read and write privileges to the current, and the following:Which statement is true?()

A.Compilation fails.

B.Nothing is added to the file system.

C.Only a new file is created on the file system.

D.Only a new directory is created on the file system.

E.Both a new file and a new directory are created on the file system.


参考答案:B

第3题:

Chinese married couple () red packets to children and the unmarried during the Chinese new Year.

A.give

B.have been giving

C.are giving

D.have given


参考答案:A

第4题:

public class TestString3 {  public static void main(String[] args) {  // insert code here  System.out.println(s);  }  }  Which two code fragments, inserted independently at line 3, generate the output 4247?()

  • A、 String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;
  • B、 StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);
  • C、 StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);
  • D、 StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);
  • E、 StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);

正确答案:B,E

第5题:

Given:andtwoseparatecommandlineinvocations:javaYippeejavaYippee1234Whatistheresult?()

A.Nooutputisproduced.123

B.Nooutputisproduced.234

C.Nooutputisproduced.1234

D.Anexceptionisthrownatruntime.123


参考答案:B

第6题:

Given:Which code, inserted at line 4, guarantees that this program will output [1, 2]()?

A.Set set = new TreeSet();

B.Set set = new HashSet();

C.Set set = new SortedSet();

D.List set = new SortedList();

E.Set set = new LinkedHashSet();


参考答案:A

第7题:

Given the community: community transit-peers members "^(123|456):[3579].0?$"; Which threecommunities does this expression match? ()

A. 456:91

B. 123:70

C. 123:440

D. 456:321

E. 123:550


参考答案:A, B, E

第8题:

If a new key 67 is inserted into the given hash table,what will be its address?

A.3

B.4

C.5

D.6


正确答案:B

第9题:

It was said that the new car__________to the institute as a gift by a businessman.

A.had given
B.would give
C.had been given
D.has been given

答案:C
解析:
考查时态、语态。答案选择哪一个,取决于was。It was said that...表示“据说……”发生在过去某时,而give这个动作发生在过去的过去,因此应用过去完成时。

第10题:

Given:  Integer i = new Integer (42);  Long l = new Long (42);  Double d = new Double (42.0);   Which two expression evaluate to true?()

  • A、 (i = = l)
  • B、 (i = = d)
  • C、 (d = = l)
  • D、 (i.equals(d))
  • E、 (i.equals(i))
  • F、 (i.equals(42))

正确答案:D,E

更多相关问题