code_junkie

try-catch block in Java - execution statements in catch code

Nov 14th, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. public class Test1 {
  2.  
  3. public static void calculate() {
  4. try {
  5. int h = 5/0;
  6. } catch (ArithmeticException e) {
  7. System.out.println("Hi!");
  8. e.printStackTrace();
  9. }
  10. System.out.println("Bye!");
  11. }
  12.  
  13. public static void main(String[] args) {
  14. calculate();
  15. }
  16.  
  17. }
  18.  
  19. Exception.printStackTrace()
  20.  
  21. Exception.printStackTrace()
Add Comment
Please, Sign In to add comment