File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why is the error "missing return statement"

 
Varuna Seneviratna
Ranch Hand
Posts: 169
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator





The TestDrive has the "main"
When the return statement is included why do I get the error "Missing return statement".Is there a particular place where the return statement should be situated.


Varuna
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The checkUserGuess does not in all cases return something. If the locationCells array is empty, no return statement is ever reached.
 
ruban raj
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to place return statement out of "for loop" in side of checkUserGuess() method.

Thanks and regards,

Vasiammal.p
 
Campbell Ritchie
Sheriff
Pie
Posts: 47232
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by ruban raj:
You have to place return statement out of "for loop" . . .


Agree. In fact the return statements, if they are actually executed, will break the repetition by terminating the loop.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic