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 trialAlexander Nowak
498 PointsDo while loops quiz, second question
Could somebody please check my code and point out what I'm doing wrong.
Thanks guys!
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
boolean isNotRight;
do {
response = console.readLine("Do you understand do while loops");
isNotRight = (response.equals("No"));
if (isNotRight) {
console.printf("Do you understand do while loops");
}
while (isNotRight);
1 Answer
rydavim
18,814 PointsWelcome to Treehouse! It looks like you advanced past your original question on your own - nice job!
The printf method is used to print a formatted string using placeholders for variables. Here is an example to get you started:
String name = "Jane Doe";
console.printf("Hello, %s!", name); // This will print: "Hello, Jane Doe!"
Alexander Nowak
498 PointsPerfect! Thank you so much!
Alexander Nowak
498 PointsAlexander Nowak
498 PointsHi guys, got passed this bit and on the last part "Finally, using console.printf print out a formatted string that says "Because you said <response>, you passed the test!"
This is my code and its not working