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 trialJules Bekabisya
707 PointsCreate a new variable called name and accept input from the console using the readLine method.
Create a new variable called name and accept input from the console using the readLine method.
// I've imported java.io.Console for you. It is stored in a variable called console for you.
4 Answers
Jake Nisenboim
3,374 PointsString name = console.readLine("Enter your name: ");
String pastTenseVerb = console.readLine("Enter a past tense verb: ");
console.printf("%s really %s this coding exercise.", name, pastTenseVerb);
A X
12,842 PointsThis is an older post & an older reply, but I do think that the current wording of the code challenge: "Create a new variable called name and accept input from the console using the readLine method" should produce the result:
String name = console.readLine;
which results in an error but I'm not clear why and what the error means.
Amadou Sow
6,082 PointsFor some reason when I write the same code it doesn't work but when I copy and past, it does work :)
Augusto Hernandes
1,818 Points(1) String name = console.readLine("Enter your name: ");
(2) String pastTenseVerb = console.readLine("Enter a past tense verb: ");
(3) console.printf("%s really %s this coding exercise.", name, pastTenseVerb);
jacobproffer
24,604 PointsHey Jules,
Can you explain where you're stuck on this challenge?
Best,
Jacob
chamber of
Web Development Techdegree Student 183 PointsString name = console.readLine("enter your name "); console.printf( "%s", name);
Awais jamil
Java Web Development Techdegree Student 4,742 PointsAwais jamil
Java Web Development Techdegree Student 4,742 Pointsi don't when i wrote the same thing it didn't work but when i copied your code it worked :)