可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

Which two code fragmen


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");
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、Which code fragment, i

Which code fragment, inserted at line 24, outputs "123abc 123abc"?()Asb1.append("abc"); s1.append("abc")...

2、Which code fragments w

Which code fragments will succeed in initializing a two-dimensional array named tab with a size...

3、Which code, inserted a

Which code, inserted at line 14, allows the Sprite class to compile?()ADirection d = NORTH...

4、Which code, inserted a

Which code, inserted at line 15, creates an instance of the Point class defined in Line...

5、Which code snippet, i

Which code snippet, inserted at line 8, causes the value Company to be output?()A JspWrite...

6、Which code, inserted a

Which code, inserted at line 15, allows the class Sprite to compile?()AFoo{public int bar(){r...