import java.util.*; class Main { public static void main(String args[]) { int x,y,z; System.out.println("Enter x,y values :"); Scanner s=new Scanner (System.in); try { x=s.nextInt(); y=s.nextInt(); z=x/y; System.out.println("Division of two number is : "+z); } catch(Exception e) { System.out.println(e); } } }
Enter x,y values :10 0
java.lang.ArithmeticException
/ by zero