Why use exceptions instead of return values?
if
-else
blocks checking return values.)Traditional programming languages set flags or return bad values like -1 to indicate problems. Programmers often don't check these values.
Java throws Exception
objects to indicate a
problem. These cannot be ignored.