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

Why is is telling me this: Did you use console.printf and to write out the formatted string with the response?

This is for the answer to the question

Finally, using console.printf print out a formatted string that says "Because you said <response>, you passed the test!"

String response; boolean evaluateResponse; do { response = console.readLine("Do you understand do while loops? "); evaluateResponse = response.equalsIgnoreCase("No"); console.printf("Because you said",response,"you passed the test"); } while (evaluateResponse);

3 Answers

Antonio De Rose
Antonio De Rose
20,885 Points

number one, please use, code formatting, that'd be really helpful in reading your questions, when you post code.

Antonio De Rose
Antonio De Rose
20,885 Points

Sorry, I cannot read your coding, as it is not been using, the already given, code formatter, I generally, do not give answers, but, I had to give, since am unable to read your code

String response = "";

do {
   response = console.readLine("Do you understand do while loops? ");
}while(response == "No");

String response;

boolean evaluateResponse;

do

{ response = console.readLine("Do you understand do while loops? ");

evaluateResponse = response.equalsIgnoreCase("No");

}

while (evaluateResponse);

console.printf("Because you said" + response +"you passed the test");

// * It is complaining about console.printf("Because you said" + response +"you passed the test");

The request was:

Using console.printf print out a formatted string that says "Because you said <response>, you passed the test!" *//

Michelle Huang
Michelle Huang
5,261 Points

the console.printf method should be outside of the do while loop as it is a final print out use %s instead of concatenation as best practice

hope this helps