Menu
  • HOME
  • TAGS

Java “add return statement” error

java,return,unreachable-statement

You need a return in the else case. public class1 foo ( class1 t) { if ( object == null ) return t; else return foo(t.childObject); } ...

should a return statement be the last instruction within a code block?

java,compilation,return,unreachable-statement

When the return statement is executed, what do you expect to happen next!? Control returns to the calling program and the statement following return can never be executed. It looks like you really want to implement this function, which apparently refunds the current balance as follows: public int refundBalance() {...