What is the difference between an exception and a return value in Java?

  java, question

What is the difference between an exception and a return value in @xiao_264028 Java?

Logically speaking, the return value of a function is its evaluation result, which is the result of “expected” and “normal” end of function evaluation. Exceptions are situations that must be handled when an error occurs and function evaluation cannot proceed normally.

For example, the derivative function of f(x) = abs(x) evaluates to 1 when x>0, to -1 when x<0, and to “exception” when x==0, because there is no return value.