public class ExDem2b { public static void main(String[] arg) { Integer num = 0; try { num = new Integer(arg[0]); if ((num % 2) != 0) throw new ArithmeticException(); System.out.println(num + " is even"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Please try again with a command-line argument"); } catch (NumberFormatException e) { System.out.println("only integers allowed"); } catch (ArithmeticException e) { System.out.println(num + " is odd"); } finally { System.out.println("No matter what, have a nice day!"); } } }