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 trialJustin Townsend
4,720 PointsJava noob
I have watched the previous video 3 times and i still don't understand what I am suppose to do
// I have initialized a java.io.Console for you. It is in a variable named console.
String response = console.readLine("Do you understand while loops?");
1 Answer
Justin Townsend
4,720 PointsThanks brother the part I didn't grasp was the do while loops, loops are a bit confusing for me
Mihailo Jakovljevic
9,259 PointsNo problem they were tough for me as well when i started java, but the most important thing is to keep grinding.
Mihailo Jakovljevic
9,259 PointsMihailo Jakovljevic
9,259 PointsHi i'm not sure what you do not understand so i am going to explain to you everything step by step. Step 1:
This is pretty straightforward and i can see that you understand it. Step 2:
What you are doing here is creating a do while loop. The main difference between do while and while loop is that do while loop is guaranteed to loop at least once. So you will input you answer in console if its "No" it will loop again and if it anything else you will exit the loop. Step 3:
Now you just print out the result. Hope this helps :D