Import java.util.Scanner;
class MultiCatch
{
public static void main(String arias())
int x,z;
Scanner in = new Scanner(System.in);
System.out.print("Enter number : ");
x = in.nextInt();
try
{
z = 50 / x; //statementl
System.out.println("Division: "+z);
System.out.println("Try end...");
}
catch(ArithmeticException e)
{
System.out.println("Division by zero error.");
}
catch(IOException e) {
System.out.println("your are trying to divide number greater than 50 whch throw exception."); }
catch(NumberFormatException e) {
System.out.println("Invalid number."); }
System.out.println("Program end..."); }
//end of main()
}//end of class
output:
Enter number : 0
Division by zero error.
Enter number : -4
Invalid number.
Enter number : 160
your are trying to divide number greater than 50 whch throw exception.