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,779 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.