Oracle
1Z0-851 · Question #179
Given: public class Breaker { static String o = ""; public static void main(String[] args) { z: o = o + 2; for(int x = 3; x < 8; x++) { if(x==4) break; if(x==6) break z; o = o + x; }…
The correct answer is G. Compilation fails. See the full explanation below for the reasoning.
Question
Given: public class Breaker { static String o = ""; public static void main(String[] args) { z: o = o + 2; for(int x = 3; x < 8; x++) { if(x==4) break; if(x==6) break z; o = o + x; } System.out.println(o); } } What is the result?
Options
- A23
- B234
- C235
- D2345
- E2357
- F23457
- GCompilation fails.
How the community answered
(33 responses)- A12% (4)
- B6% (2)
- E3% (1)
- F3% (1)
- G76% (25)
Community Discussion
No community discussion yet for this question.