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 trialDhruv Reddy
269 PointsCould somebody please check the code
//Loop
boolean isInvalidWord;
do {
noun = console.readline("Enter a noun: ");
isInvalidWord = (noun.equalsIgnoreCase("dork")||
noun.equalsIgnoreCase("jerk"));
if (isInvalidWord) {
console.printf("That language is not allowed. Try again. \n\n");
}
} while (isInvalidWord);
String adverb = console.readLine("Enter an adverb: ");
String verb = console.readLine("Enter a verb ending in -ing: ");
console.printf("%s is a %s %s.", name, adjective, noun);
console.printf("They are always %s %s.\n", adverb, verb);
}
} //It keeps saying that string cannot be converted into boolean for the 3rd line (showed below)
noun = console.readline("Enter a noun: ");
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, Dhruv Reddy! You just have a small typo. You typed readline
instead of readLine
. Note that the correct method contains a capital "L". Remember that this is all case-sensitive.
Hope this helps!