Lecture 21
22
Exception strategy
•try {
• System.out.println(”Are you " + args[0] +'?');    
• rumpelstiltskin.guessName(args[0]);
• System.out.println("Yes! How did you guess?");
• System.exit(0); // leave program gracefully
•}
•// come here right away if there is no args[0]
•catch (IndexOutOfBoundsException e) {
•   System.out.println(
–  "usage: java RumpelStiltskin guess");
–System.exit(0); // leave program gracefully
•}