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.——————————————————————————————————————————————————————
Given:
1. public class Breaker{
2. static String o = "";
3. public static void main(String[] args){
4. z:
5. o = o + 2;
6. for(int x=3; x<8; x++){
7. if(x == 4) break;
8. if(x == 6) break z;
9. o = o + x;
10. }
11. System.out.println(o);
12. }
13. }
What is the result?
A. 23
B. 234
C. 235
D. 2345
E. 2357
F. 23457
G. Compilation fails.——————————————————————————————————————————————————Given:
1. public class Breaker2{
2. static String o = "";
3. public static void main(String[] args){
4. z:
5. for(int x=2; x<7; x++){
6. if(x == 3) continue;
7. if(x == 5) break z;
8. o = o + x;
9. }
10. System.out.println(o);
11. }
12. }
What is the result?
A. 2
B. 24
C. 234
D. 246
E. 2346
F. Compilation fails.不是很明白当中的 z: 指的是啥?当时就蒙了!!当然上机就能得出答案,望高手说明原因!谢谢
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.——————————————————————————————————————————————————————
Given:
1. public class Breaker{
2. static String o = "";
3. public static void main(String[] args){
4. z:
5. o = o + 2;
6. for(int x=3; x<8; x++){
7. if(x == 4) break;
8. if(x == 6) break z;
9. o = o + x;
10. }
11. System.out.println(o);
12. }
13. }
What is the result?
A. 23
B. 234
C. 235
D. 2345
E. 2357
F. 23457
G. Compilation fails.——————————————————————————————————————————————————Given:
1. public class Breaker2{
2. static String o = "";
3. public static void main(String[] args){
4. z:
5. for(int x=2; x<7; x++){
6. if(x == 3) continue;
7. if(x == 5) break z;
8. o = o + x;
9. }
10. System.out.println(o);
11. }
12. }
What is the result?
A. 2
B. 24
C. 234
D. 246
E. 2346
F. Compilation fails.不是很明白当中的 z: 指的是啥?当时就蒙了!!当然上机就能得出答案,望高手说明原因!谢谢
解决方案 »
- 求助!java遍历C盘生成目录树
- String转成日期型
- 一个奇怪的问题,table的一列设置了CellEditor,当其获得焦点时tableModel.setValue操作对该cell无效。
- DriverManager.getConnection出现异常 和 MSDE有关系么?谢谢!
- 新手求教:如何实现类似mdi窗口的java程序??
- 游戏运行运行十几分钟后出现下面的错误,各位兄弟帮忙解决一下
- 关于java程序里面大小写问题,想请教大家
- 如何在FilenameFilter 的 accpet(File dir,String name)里面判断是否是一个目录?
- 各位打内高手,请问java中,我怎样获取一个随机值
- 我要创建一个模式对话框,但是......
- SafeBufferedReader这个类在哪
- TreeSet中的各类问题
可以看看下面的这个
http://jgs80.blog.163.com/blog/static/3566265320069410175599/
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);
}
}
}
楼主,第二段代码,编译时通过不了的上面的括号位置不对参考下边这个
我也刚试了下,的确是!谢谢提醒!!!经修改:public class Test{
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);
}
}