問題詳情

Given:22. public void go(){23. String o = "";24. z:25. for(int x=0; x<3; x++){26. for(int y=0; y<2; y++){27. if(x == 1) break;28. if(x==2 && y==1) break z;29. o = o + x + y;30. }31. }32. System.out.println(o);33. }What is the result when the go() method is invoked?
(A) 00
(B) 0001
(C) 000120
(D) 00012021
(E) Compilation fails.F. An exception is thrown at runtime.

參考答案

答案:C
難度:簡單0.730924
統計:A(9),B(20),C(182),D(10),E(18)

用户評論

【用戶】Joe Chen

【年級】

【評論內容】Given: 22. public void go(){ 23. String o = ""; 24. z: 25. for(int x=0; x<3; x++){ 26. for(int y=0; y<2; y++){ 27. if(x == 1) break; 28. if(x==2 && y==1) break z; 29. o = o + x + y; 30. } 31. } 32. System.out.println(o); 33. } What is the result when the go() method is invoked?(A) 00(B) 0001(C) 000120(D) 00012021(E) Compilation fails. F. An exception is thrown at runtime.