Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Java error: missing return statement?

$
0
0
Here is my method:

//usedLetters method to check if user's guess has already been guessed
private boolean usedLetters(char used[], char alphabet) throws IOException
{
   for(int x=0; x<used.length; x++){

    if(alphabet == used[x])
    {
        return true;
    }

    else
    {
        used[dataSize] = alphabet;
        return false;
    }
    }
}//End of usedLetters method

IT checks to see if the alphabet that the user entered in an another method has already been guessed. If it has already been guessed, it returns true, and if has not been already guessed, it adds the alphabet into used, and returns false. But the error says that there are no return statements...I am not familiar with methods in general, so I am confused. Any help would be appreciated!

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>