I've been investigating Java's ParseException
, when trying to write my own method that parses from a String
to an int
, and have two questions:
- When should I throw it? Java's
Integer.parseInt(String string)
throws aNumberFormatException
when an invalid input is given (makes sense with it being a subclass ofIllegalArgumentException
), and does not throwParseException
at all. - What is "
errorOffset
"?ParseException
's constructor forces you to give it a value - what does it mean?