基本程式語言 05
出自 陳富國維基館
下 列 片 斷 程 式 執 行。 QUESTION 8 Given the exhibit: public class Certkiller3 { public static viod main (String[] args){ //insert code here System.out.println(s); } } Which two code fragments, inserted independently at line 3, generate the output 4247? (choose two) 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) replace(1,3,). Delete (2,5) insert (1, "24")
解答
Ans: B.E
解說:
類似題型
題目
解說:
程式觀念考題 | |||||
---|---|---|---|---|---|
基本程式語言 | 決策程式語法 | 迴圈/重複敘述 | 副程式呼叫與遞迴 | 物件導向-類別與物件 | 其他 |
|
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |
06 . 07 . 08 . 09 . 10 11 . 12 . 13 . 14 . 15 |