// Not public, so we don't need a second file...
class YetAnotherException extends Exception {
    public YetAnotherException( String message ) {
        super(message);
    }
}

// Experiment: try removing the throws statements to see what happens.
public class AnotherExceptionDemo {
 
    public static int exampleMethod( int x ) throws YetAnotherException {
        if (x < 0)
            throw new YetAnotherException("THAT WHICH HAS GONE WRONG IS " + x);
        return 0;
    }

    public static void main(String args[]) throws YetAnotherException {  //, Exception {
        System.out.println("Something is about to go wrong; I can feel it!");
        System.out.println("First call: " + exampleMethod(1));
        System.out.println("Second call: " + exampleMethod(-1));
        System.out.println("But I won't live to tell the tale.");
        
        // FROM CLASS 
        //if ( args.length > 0) 
        //    throw new Exception("Bad things have happened.");
        //System.out.println("I've lived to tell the tale.");
    }
}

