/** * Title: CmdLine2 * Description: Demo of custom exception * @author hollingd@cs.rpi.edu */ // create our own type of exception // exceptions are just objects ! class CmdLineException extends Exception { CmdLineException(){} CmdLineException(String s) { super(s); } } // a class that can convert an array of Strings to // to an array of integers. class CmdLineInts { int x[]; // Constructor with just args, in this case we // don't care how many are specified on the command line, // we convert them all CmdLineInts(String args[] ) throws CmdLineException { x = new int[args.length]; int i=0; try { for (i=0;i