import java.util.*;
public class Throw_Demo
{
public static void main(String[] args) //throws Ooops






{
        Candidates candidates;
        candidates = new Candidates();
        try
        {
                candidates.addCandidate("Al Gore");
                candidates.addCandidate("George Bush");
                candidates.removeCandidate("Al Gore");
                candidates.removeCandidate("George Bush"); // I know this will throw exception Ooops
        }
        catch (Ooops e)
        {
                System.out.println("In Catch Ooops");
                try
                {
                        candidates.candidates.get(20); // I know this will throw exception ArrayIndexOutOfBoundsException
                }
                catch (ArrayIndexOutOfBoundsException f)
                {
                        System.out.println("In Catch Array");
                }
        }
        finally
        {
                System.out.println("In Finally");
        }
} // method main

} // class Throw_Demo

class Ooops extends Exception
{
Ooops(String message)
{
        super(message);
} // constructor Ooops

} // class Ooops
class Candidates
{
        public Vector candidates;
public Candidates()
{
        candidates = new Vector();
}
public void addCandidate(String aName) throws Ooops
{
        candidates.addElement(aName);
}
public void removeCandidate(String aName) throws Ooops
{
        candidates.removeElement(aName);
        if (candidates.size() == 0)
                throw (new Ooops("Vector Empty"));
}
}

