Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialZeki Ye
364 PointsNot a statement error and ';' expected error
This is my code : String noun; boolean isInvalidWord;
do {
noun = console.readLine("Enter a noun: ");
isInvalidWord = (noun.equalsIgnoreCase("dork") ||
(noun.equalsIgnoreCase("nerd");
if (isInvalidWord) {
console.printf("That language is not allowed. Try again. \n\n");
}
} while(isInvalidWord);
It says I have 8 errors, and it only shows 2 of them, the 2 that I know is not a statement and ';' expected error, please help me, Im stuck on this one because I do not know what is wrong, thanks.
1 Answer
erickheredia
8,814 PointsAssuming that you defined noun and isInvalidWord, the issue here is the following:
Right Answer isInvalidWord = (noun.equalsIgnoreCase("dork") || noun.equalsIgnoreCase("nerd"));
Wrong Answer isInvalidWord = (noun.equalsIgnoreCase("dork") || (noun.equalsIgnoreCase("nerd");
You added an extra (.
Zeki Ye
364 PointsZeki Ye
364 PointsThe first part, String noun; boolean isInvalidWord;
didn't get put inside the code so yeah