I had a job interview today where I was asked to write a Java method that took a String object as input and outputted the int it was equivalent to. I needed to throw an exception if the number was too big, and my interviewer indicated there is an existing exception I can use that indicates overflow. Anybody have any idea what that exception is?
NumberFormatException is a subclass of IllegalArgumentException that could be used here. In fact, it [i]is[/] used by the Integer.parseInt() method, which seems to be equivalent to what the applicant is being asked to write.