You are on page 1of 1

Exception of java

import java.util.Scanner;
public class Test{

public static void main(String[] args)


{
divide();
}
static void divide() {
int a,b;
Scanner s=new Scanner(System.in);
a=s.nextInt();
b=s.nextInt();
try {
System.out.println(a/b);
}
catch(ArithmeticException ae)
{
System.out.println("donot devide value by
zero");
}

You might also like