public class ExceptionTest { public static void main (String args[]) { if (args.length != 1) { System.out.println("Bitte eine Zahl als Parameter angeben"); return; } String[] seasons = {"Fruehling", "Sommer", "Herbst", "Winter"}; int index = 0; String s = args[0]; try { index = Integer.parseInt(s); String season = seasons[index]; System.out.println("Jahreszeit: " + season); } catch (NumberFormatException e) { e.printStackTrace(); e.getMessage(); System.out.println("Eingabe enthaelt ein ungueltiges Zeichen"); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Eingabe enthaelt einen ungueltigen Indexwert"); } System.out.println ("Ende"); } }