[Solved] Java program. How do I loop my “isLucky” method through my array? Also, how do I print my results correctly in the main method?
Your compiler error, ‘else’ without ‘if’ is because you have something like this: if(isOkay) doSomething(); andThenDoSomethingElse(); else doAnotherThing(); andEvenSomethingElse(); And you must put each block in curly braces, like this: if(isOkay) { doSomething(); andThenDoSomethingElse(); } else { doAnotherThing(); andEvenSomethingElse(); } I strongly recommend using curly braces in all ifs (and whiles and fors and everything … Read more