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 trialSGT Awesome
480 PointsI dont know where to start?! Help!!!!
I have no idea where to start. I dont know how to prompt the user! Help!!!!
// 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);
1 Answer
Michael Hess
24,512 PointsHi 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!
SGT Awesome
480 PointsThank 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
24,512 PointsMy pleasure! I'm glad that I was able to help!
Harry Jones
2,964 PointsHarry Jones
2,964 PointsAre the two lines below the comment things you wrote?