Greg Charles wrote:Yes, NumberFormatException is the exception that would be thrown, but IllegalArgumentException is its superclass, so catching that would also do the job. The word "appropriate" is somewhat subjective, but I'd argue both are appropriate here, though I might waffle a bit if catching Throwable would also be. From what I remember about SCJP though, it's not trying to trick you with fine points about programing style.
Note: it's Kathy Sierra. Kathy Bates is the one who bashed in James Caan's knees in Misery