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

Loop

Here I'm lost don't see the way

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

2 Answers

Tonnie Fanadez
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Tonnie Fanadez
UX Design Techdegree Graduate 22,796 Points

Hello Nkosinolwazi Moyo

I note you are really putting effort to learn Java and I am impressed. Keep taking the video tutorials in and asking questions, eventually, all the pieces will come together like magic and you will be a Java Pro. We all once started where you are; so keep pushing!!

Now you only need to call console's method readLine() which reads a single line of text from the console object and returns a String. This method takes the prompting message as an argument and this is what is displayed to the user. When the user hits the enter key the console.readLine() method stores the input from the keyboard as a String.

So you only need to declare String response (which I see you have already done ) and initialize it to the console.readLine() method and provide the prompting message inside the brackets.

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

Great i really appreciate your assistance. I'm just new to any of these ; terms computer programming language, but I will get thereverything ,I know.