aspose file tools
The moose likes Beginning Java and the fly likes Why is the error Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Why is the error "missing return statement"" Watch "Why is the error "missing return statement"" New topic
Author

Why is the error "missing return statement"

Varuna Seneviratna
Ranch Hand

Joined: Jan 15, 2007
Posts: 164





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


Varuna Seneviratna
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35241
    
    7
The checkUserGuess does not in all cases return something. If the locationCells array is empty, no return statement is ever reached.


Android appsImageJ pluginsJava web charts
ruban raj
Greenhorn

Joined: Aug 05, 2008
Posts: 7
You have to place return statement out of "for loop" in side of checkUserGuess() method.

Thanks and regards,

Vasiammal.p
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32675
    
    4
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why is the error "missing return statement"
 
Similar Threads
HFJ SimpleDotCom problems
Help compiling Program
Head first Java; simpledotcom problems...
Problem with Chapter 5 - SimpleDotCom
i am not able to get out put of this program