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

I dont know where to start?! Help!!!!

I have no idea where to start. I dont know how to prompt the user! Help!!!!

Example.java
// I have initialized a java.io.Console for you. It is in a variable named console.

String userQuestion = console.printf("Do you understand do while loops?");
String userAnswer = Integer.parseInt(userQuestion);

Are the two lines below the comment things you wrote?

1 Answer

Michael Hess
Michael Hess
24,512 Points

Hi SGT Awesome,

First declare a variable called response that is a String. Then set response equal to console.readLine("Do you understand do while loops?");

This will get you started:

//Declare a String variable named response, then initialize it using double quotes
String response;

response = console.readLine("Do you understand do while loops?");  // "yes" or "no" is stored in response variable

If you have any other questions feel free to ask!

Thank you SOOOOO MUCH! It turns out I understood how do it but it was with the guidance of your comment that showed me my syntax structure was backwards so, thank you!!!!! ^_^

Michael Hess
Michael Hess
24,512 Points

My pleasure! I'm glad that I was able to help!