/home/wpollock1/public_html/Java/ThrowExceptionDemo.java

public class ThrowExceptionDemo {

  public static String foo ( int num ) throws IllegalArgumentException {
    if ( num < 0 )
       throw new IllegalArgumentException( "Oops!" );
    return "Yippie!";
  }
}

class ThrowExceptionDemoTest {
  public static void main ( String [] args ) {
    String result = null;
    try {
      result = ThrowExceptionDemo.foo( -1 );
    } catch ( IllegalArgumentException iae) {
       System.out.println( "You ARE the weakest link, good-bye!" );
    }
    System.out.println( result );
  }
}