Sample Program:-
package payilagam.institution;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Exception{
public static void main(String[] args)
{
System.out.println("Please enter two numbers");
Scanner sc = new Scanner(System.in);
try
{
int no1 = sc.nextInt();//50
int no2 = sc.nextInt();//abcd
System.out.println(no1/no2);
int[] ar = new int[no1];
System.out.println("array Length is"+ar.length);
}
catch(ArithmeticException ae)
{
System.out.println("Check no2");
}
catch(NegativeArraySizeException rt)
{
System.out.println("please enter +ve value");
}
catch(InputMismatchException ime)
{
System.out.println("Please give inputs properly");
}
}
}
Output Screenshots:-



