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 trial

Java

Output a sentence that takes both the noun and past tense verb using a single statement. It should look like this......

String name = console.readLine("Scorpion"); String pastTenseVerb = console.readLine("hated"); console.printf("%s really %s this coding exercise.", name, pastTenseVerb);

9 Answers

console.readLine shouldn't take any parameters since this function does not output, but takes input from the user when it is run in the console.

String name = console.readLine(); 
String pastTenseVerb = console.readLine(); 
console.printf("%s really %s this coding exercise.", name, pastTenseVerb);

Yeah Adam, Kevin is right. However, you want to also ask the user what to enter as a name. String name = console.readLine("Enter a name: ");

Hey buddy I've GOT IT!!! I can't BELIEVE what I was doing wrong. smh

System.out.print("Enter a noun: ");
String name = console.readLine(); 
System.out.print("Enter a past tense verb: ");
String pastTenseVerb = console.readline(); 
console.printf("%s really %s this coding exercise.", name, pastTenseVerb);

Try that. Like I said, the console.readLine() function shouldn't take any parameters, so there should be no text inside of the parenthesis of readLine().

This is what I did. Not having any luck.

String name = console.readLine("name"); String pastTenseVerb = console.readline("Enter a past tense verb."); console.printf("%s really %s this coding exercise.", name, pastTenseVerb);

Sorry, it's not working.

I'm not sure what will work without being able to see what the challenge is asking for specifically.

Okay. Here's the exact question. "Output a sentence that takes both the name and past tense verb using a single statement. It should look like this: name really past tense verb this coding exercise"

{{{String name = console.readLine("Adam"); String pastTenseVerb = console.readLine("hates"); console.printf("%s really %s this coding exercise.", name, pastTenseVerb);}}};

^^^That was the answer. I tried use markdown but I'm still getting the hang of all this. Thanks Kevin for your time and support.

yeah i'm having the same issue with the input below:

String 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);

yeah i'm having the same issue with the input below:

String 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);