Exception Handling

Submitted by Karthik on

import java.io.*;
class exhand

{

    public static void main(String args[])
    {
        try
        {
            System.out.println("Before division");
            int i = Integer.parseInt(args[0]);
            int j = Integer.parseInt(args[1]);
            System.out.println("Afer Division");
            System.out.println(i/j);
        }
        catch(ArithmeticException e)
        {
            System.out.println("Error in denomination");
        }
        catch(ArrayIndexOutOfBoundsException ae)
        {
            System.out.println("Array range out of range");
        }
        catch(NumberFormatException ze)
        {
            System.out.println("Data type Error");
        }
        finally
        {
            System.out.println("final block arrived");
        }

        }
    }