1. public class Test { 2. public static void main(String[] args) { 3. int x = 0; 4. assert (x > 0) ? “assertion failed” : “assertion passed”; 5. System.out.println(“Finished”); 6. } 7. }
Show comments for this question (0) Add comments Link to this question
Show comments for this question (1) Add comments Link to this question
11. switch(x) { 12. default: 13. System.out.println(“Hello”); 14. }
1. public class X { 2. public static void main(String [] args) { 3. try { 4. badMothod(); 5. System.out.println(“A”); 6. } 7. catch (RuntimeException ex) { 8. System.out.println(“B”); 9. } 10. catch (Exception ex1) { 11. System.out.println(“C”); 12. } 13. finally { 14. System.out.println(“D”); 15. } 16. System.out.println(“E”); 17. } 18. public static void badMethod() { 19. throw new RunTimeException(); 20. } 21. }