Missing Return Statement
The “missing return statement” message occurs when a method does not have a return statement. Each method that returns a value (a non-void type) must have a statement that literally returns that value so it can be called outside the method.
There are a couple reasons why a compiler throws the “missing return statement” message:
- A return statement was simply omitted by mistake.
- The method did not return any value but type void was not declared in the method signature.
0 Comments
Post a Comment