单项选择题

Given:
42. void go() {
43. int cows = 0;
44. int[] twisters = {1,2,3};
45. for(int i = 0; i < 4; i++)
46. switch(twisters[i]) {
47. case 2: cows++;
48. case 1: cows += 10;
49. case 0: go();
50. }
51. System.out.println(cows);
52. }
What is the result

A.11
B.21
C.22
D.Compilation fails.
E.A StackOverflowError is thrown at runtime.
F.An ArraylndexOutOfBoundsException is thrown at runtime.
题目列表

你可能感兴趣的试题

微信扫码免费搜题