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 trialJordan Crowell
787 PointsI don't understand what the comment of the top of this exericse means about java.io.Console?
I don't understand what I am supposed to do with the comment that was mentioned about a variable named console. Can someone help me out?
// I have initialized a java.io.Console for you. It is in a variable named console.
String response;
boolean yesOrNo;
do{
response = console.readLine("Do you understand do while loops?");
//yesOrNo = (response.equalsIgnoreCase("no"));
if( response.equalsIgnoreCase("yes") ) {
System.exit(0);
}
} while( response.equalsIgnoreCase("No"));
1 Answer
Crystal Tate
2,344 PointsThe comment says that java.io.Console
is defined in a variable named console
. This means you can use console.readLine()
instead of java.io.Console.readLine()
.
Allan Clark
10,810 PointsNext time use the answer box so you can get those lovely lovey internet points ;)
Jordan Crowell
787 PointsJordan Crowell
787 PointsThanks so much!