In this case multi-catch is not required because NumberFormatException
is derived from Exception
. You can simply catch only Exception
to get them both. If you need another handling for NumberFormatException
than for other exceptions, you must use the example you posted first.