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 trial

Java Java Basics Perfecting the Prototype Looping until the value passes

Amit Dhamankar
Amit Dhamankar
4,163 Points

I am not getting this quiz. Please help me.

see I am totally confused what wrong I have written in this code. I am totally confused with the equality of strings. Well Craig has taught really nice but still I am getting problems during coding. And one thing how can i contact Craig?

Example.java
// I have initialized a java.io.Console for you. It is in a variable named console.
String response = console.readLine("Do you understand do while loops?");
do {
  if(response.equalsIsIgnore("Yes")) {
  console.printf("It seems you are a hardworker");
  }

} while(response.equalsIgnoreCase("No"));

1 Answer

Isaiah Marin
Isaiah Marin
11,971 Points

Hi Amit,

Well, are you referring to the challenge, Looping until the value passes? If so, I found that you have to follow the instructions closely. With that said, I have found errors only pertaining to his instructions but do not notice any syntax errors.

The main error is the content inside the do while loop. This is because he only ask you to re-prompt the user with the same String response and with the same question you asked with response. Thus it should keep asking the user, "Do you understand do while loops?" until the user enters a word other than No.

After the do while loop checks for the input to make sure it is not equal to the word, "No" it should print out, "Because you said (the string response goes here), you passed the test!"

I've tried to answer your question without providing the actual code since it is a challenge and you seem to be ok with the actual code. Just not the instructions the challenged ask.

Hope this helps, Isaiah Marin