Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. public class Exception {
  2. public static void main(String[] args) {
  3. try{
  4. int d=0, n=20; //fraction =n/d;
  5.  
  6. }catch(ArithmeticException e){
  7. System.out.println("In the catch clock due to Exception=" +e);
  8.  
  9. }finally{
  10. System.out.println("Inside the finally block.");
  11. }
  12. }}
  13.  
  14. int d=0, n=20;
  15. if(n/d){
  16. throw new ArithmeticException("Number divided by zero");
  17. }else{
  18. System.out.println("ABC");
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement