"SCJP 1.6版考題 098" 修訂間的差異
出自 陳富國維基館
(新頁面: 15. public class Yippee{ 16. public static void main(String[] args){ 17. for(int x = 1; x < args.length; x++){ 18. System.out.print(args[x] + " "); 19. } 20. ...) |
(無差異)
|
於 2013年3月30日 (六) 05:48 的最新修訂
15. public class Yippee{
16. public static void main(String[] args){
17. for(int x = 1; x < args.length; x++){
18. System.out.print(args[x] + " ");
19. }
20. }
21. }
and two separate command line invocations:
java Yippee
java Yippee 1 2 3 4
What is the result?
A. No output is produced.
1 2 3
B. No output is produced.
2 3 4
C. No output is produced.
1 2 3 4
D. An exception is thrown at runtime.
1 2 3
E. An exception is thrown at runtime.
2 3 4
F. An exception is thrown at runtime
1 2 3 4
解答
Ans: B
解說:
第一次執行,沒有參數,args.length=0,for迴圈不會跑 第二次執行,有4個參數,args.length=4,for迴圈從1~3,印args[1]~args[3]
| ||||||||||||||||||||