import java.io.*;

/**
 * Example of try-catch-finally structure.
 * @author Mitch Fincher
 */

////////////////////////////////////////////////////////////////
public class ExceptionExample 
////////////////////////////////////////////////////////////////
{

////////////////////////////////////////////////////////////////
  public ExceptionExample (int test) throws Exception 
////////////////////////////////////////////////////////////////
  {
    try {
      if(test > 5)
	throw (new Exception("value is greater than 5."));      
    } // try
    catch(Exception ex)
      { 
	System.out.println("ExceptionExample: exception thrown " + ex);
      }
    finally
      {
	System.out.println("ExceptionExample: finally clause executed. " );
      }
  }
  
/***
 * main test driver.
 * @param argv an integer.  If integer is greater than 5 an exception is thrown.
**/
////////////////////////////////////////////////////////////////
  public static void main(String argv[])
////////////////////////////////////////////////////////////////
  {
    if(argv.length < 1)
      { System.out.println("usage: ExceptionExample int" );System.exit(1); }

    try {
      ExceptionExample test = new ExceptionExample(Integer.parseInt(argv[0]));
    }
    catch(Exception ex){ System.out.println("ExceptionExample:main()" + ex);}
  }
  

  } // class ExceptionExample

