题目以下代码: 1. public class TestString1{ 2. public static void main(String[] args){ 3. String str= "420"; 以下代码: 1. public class Test{ 以下代码: 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. intx= 0; 11. inty= 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: =o+ 2; 6. for(int x=3; x<8; x++){ 7. if(x == 4) break; 8. if(x == 6) break z; =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.}运行结果是?以下代码: 1. public class Barn{ 2. public static void main(String[] args){ 3. new ("hi", 1); 4. new ("hi", "world", 2); 5.} 6. public void go(String... y, int x){ 7. (y[ - 1]+" "); 8.} 9.}运行结果是? 以下代码: 5. class Atom{ 6. Atom(){("atom ");} 7.} 8. class Rock extends Atom{ 9. Rock(String type){(type);} 10. } 11. public class Mountain extends Rock{ 12. Mountain(){ 13. super("granite ");
JAVA复习题201004答案 来自淘豆网www.taodocs.com转载请标明出处.