//TestExceptions.java
//Just to see what exception is thrown ...

import java.util.Scanner;

public class TestExceptions
{
    public static void main(String[] args)
    {
        try
        {
        System.out.println(5/0); //ArithmeticException thrown
        }
        catch (ArithmeticException e)
        {
            System.out.println("Sorry!");
        }
        //System.out.println(Math.sqrt(-1)); //Actually we get NaN
        //System.out.println(args[5]); //ArrayIndexOutOfBoundsException thrown
    }
}

/*
 * Note that the exceptins above are runtime exceptions, and as such are
 * unchecked and do not need to be explicitly dealt with by the programmer.
 */

