jeudi 24 novembre 2016

"else" without "if" (I am trying to print this from a driver method, but cannot proceed)

I am trying call this boolean method in a main method. I wonder what is wrong about this, and how should I change this, so that when I can it in the main, it will print just the "System.out.println content", but not true/false. Thanks!

public boolean checkWord(String userWord)
{
    String lowCase = userWord.toLowerCase();
    if (findWord(lowCase) != -1)

        return true;

        System.out.println(userWord + " --> " + misspellArray[findWord(lowCase)][1]);

    else

        return false;

        System.out.println("0 incorrect");

Aucun commentaire:

Enregistrer un commentaire