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 trialDakota Strege
3,005 PointsI think this looks identical to the code in the video... Yet errors?
String noun; boolean isInvalidWord; do { noun = console.readLine("Enter a noun: "); isInvalidWord = (noun.equalsIgnoreCase("dork") || noun.equalIgnoreCase ("jerk)); if (isInvalidWord) { console.printf("That language is not allowed. Try again. \n\n"); } } while(isInvalidWord);
I get 5 errors
TreeStory.java:26: error: not a statement
if (isInvalidWord) {
^
TreeStory.java:26: error: ';' expected
if (isInvalidWord) {
^
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! I believe the problem you might be having is here:
isInvalidWord = (noun.equalsIgnoreCase("dork") || noun.equalIgnoreCase ("jerk));
The string "jerk" is not finished with quotes so it thinks the rest of that is part of the string. Try this:
isInvalidWord = (noun.equalsIgnoreCase("dork") || noun.equalIgnoreCase ("jerk"))
Notice the closing quotes around the word "jerk". Hope this helps!
Dakota Strege
3,005 PointsThank you.
Dakota Strege
3,005 PointsDakota Strege
3,005 PointsNever mind... I figured it out...