文档介绍:题目
以下代码:
1. public class TestString1{
2. public static void main(String[] args){
3. String str = "420";
4. str += 42;
5. (str);
6. }
7. }
输出什么?
以下代码:
1. public class Test{
2. public static void main(String[] args){
3. int x = 5;
4. boolean b1 = true;
5. boolean b2 = false;
6.
7. if((x==4) && !b2)
8. ("1 ");
9. ("2 ");
10. if((b2=true) && b1)
11. ("3 ");
12. }
13. }
运行结果是什么?
以下代码:
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. (o);
33. }
go()方法被调用后,产生什么结果?
以下代码:
10. int x = 0;
11. int y = 10;
12. do{
13. y--;
14. ++x;
15. }while(x < 5);
16. (x + "," + y);
运行结果是?
以下代码:
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. (o);
12. }
13. }
运行结果是?
以下代码:
1. public class Spock{
2. public static void main(String[] args){
3. Long tail = 2000L;
4. Long distance = 1999L;
5. Long story = 1000L;
6. if((tail>distance) ^ ((story*2)==tail))
7. ("1");
8. if((distance+1 != tail) ^ ((story*2)==distance))
9. ("2");
10. }
11. }
运行结果是?
以下代码:
1. import .*;
2. public class Quest{
3. public static void main(String[] args){
4. String[] colors =
5. {"blue","red","green","yellow","orange"};
6. (colors);
7. int s2 = (colors, "orange");
8. int s3 = (colors, "violet");
9. (s2 + "" + s3);
10. }
11. }
运行结果是?
以下代码:
1. class Alligator{
2. public static void main(String[] args){
3. int[]x[] = {{1,2},{3,4,5},{6,7,8,9}};
4. int[][]y = x;
5. (y[2][1]);
6. }
7. }
运行结果是?