// Custom exception type.
import [Link].*;
class DivisionByZero extends Exception
{
public String toString()
{
return ("Divide By Zero Error");
}
}// end divison
class ExceptionDemo
{
public static void main(String args[])
{
Scanner sc=new Scanner([Link]);
[Link]("Enter the first value");
int a=[Link]();
[Link]("Enter the second value");
int b=[Link]();
try
{
if(b==0)
throw new DivisionByZero();
double c=a/b;
[Link](a+"/"+b+"="+c);
} catch (DivisionByZero e)
{
[Link]("Exception: " + e);
}
}//end main
}//end class