Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class ArithMaticExcep
- {
- public static void main(String[] args)
- {
- Scanner sc=new Scanner(System.in);
- int i=0;
- int j=0;
- try{
- System.out.print("Enter I : ");
- i=sc.nextInt();
- System.out.print("Enter J : ");
- j=sc.nextInt();
- float Divide=i/j;
- System.out.println("i/j"+(i/j));
- }
- catch(ArithmeticException e)
- {
- System.out.println(i+" cannot be divide by "+j);
- System.out.println("Because "+e);
- }
- finally
- {
- System.out.println("Thank You");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment