Show comments for this question (0) Add comments Link to this question
11. int i = 0, j = 5; 12. tp; 13. for (;;) { 14. i++; 15. for(;;) { 16. if (i> --j) { 17. break tp; 18. break tp; 19. } 20. } 21. System.out.println(“i=” +i “,j =”+j);
1. public abstract class Test { 2. public abstract void methodA(); 3. 4. public abstract void methodB() 5. { 6. System.out.println(“Hello”); 7. } 8. }
1. public class Test { 2. public static void main(String Args[]) { 3. int i =1, j = 0; 4. switch(i) { 5. case 2: j +=6; 6. case 4: j +=1; 7. default: j +=2; 8. case 0: j +=4; 9. } 10. System.out.println(“j =” +j); 11. } 12. }
1. class A { 2. } 3. class Alpha { 4. private A myA = new A(); 5. 6. void dolt( A a ) { 7. a = null; 8. } 9. void tryIt() { 10. dolt( myA ); 11. } 12. }
1. class Super { 2. public int i = 0; 3. 4. public Super(String text) { 5. i = 1; 6. } 7. } 8. 9. public class Sub extends Super { 10. public Sub(String text) { 11. i = 2; 12. } 13. 14. public static void main(String args[]) { 15. Sub sub = new Sub(“Hello”); 16. System.out.println(sub.i); 17. } 18. }
Show comments for this question (1) Add comments Link to this question
11. int i = 1,j = 10; 12. do{ 13. if (i>j) { 14. continue; 15. } 16. j--; 17. } while (++i <6); 18. System.out.println(“i = “ +i+” and j = “+j);
1. public class X { 2. public X aMethod() { return this;} 3. } 1. public class Y extends X { 2. 3. }
1. public class X { 2. public static void main(String [] args) { 3. try { 4. badMethod(); 5. System.out.print(“A”); 6. } 7. catch (Exception ex) { 8. System.out.print(“C”); 9. } 10. finally { 11. System.out.print(“B”); 12. } 13. System.out.print(“D”); 14. } 15. public static void badMethod() { 16. throw new Error(); 17. } 18. }