Java Java Basics Perfecting the Prototype Looping until the value passes

Complier error referring to task number?

I have been trying to do this final part of the last section of java basics and have came across an issue that I cant seem to solve with my current knowledge.

I have closely referred to the prior video on the topic of while loops and have attempted to use that into this code example attached.

ignoring whats currently there i end up with the same error mentioning about a compiler error and it isn't even referring to any of my code/answer, (regardless of what i put in there) but the task number for the code challenge?

It is also, apparently an error on line 130 as you can see there aren't that many lines of code on this example. error: ')' expected
    if (response.equalsIgnoreCase("yes"); {
                                        ^ error: while expected
   ^ error: illegal start of expression
      taskNumber = 1;
                 ^ error: ')' expected
      taskNumber = 1;
4 errors
// I have initialized a for you. It is in a variable named console.
String question = console.readLine("Do you understand do while loops?  ");
String response;
  do {


1 Answer

Steven Parker
Steven Parker
201,918 Points

Task 1 asks you to "Store the result in a new String variable named response.", but this code is storing it in a string named "question" instead.

Then in task 2, the challenge asks you to "continually prompt the user in a do while loop." The code for this isn't complete yet (there's no "while" for the loop), and the prompting will need to be moved inside the loop to be done repeatedly. The variable "response" will need to be declared (but not assigned) before the loop begins; and inside the loop, it will be assigned (but not declared).