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 trialAbhilasha jangid
2,925 Pointswhat the condition i put in while loop?? why i got an error again and again ??
java basics do while loop programming assinment
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
do{
response = console.readLine("Do you understand do while loops?");
if(response.equals("No")){
System.exit(0);
}
}while( response != ("No"));
console.printf("No");
Richard Lambert
Courses Plus Student 7,180 PointsRichard Lambert
Courses Plus Student 7,180 PointsHello mate,
I recently answered a similar question covering this task. There are a few issues with this code:
"No"
, the Java virtual machine terminates and code execution stops, which isn't the expected outcome for this task."No"
string in your do-while statement's conditional expression, nor is there any need to print a formatted string with the value"No"
to the console.Hope this helps