Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Basics Using your New Tools Multiple Format Strings

pastTenseVerb -- I dunno what problem is .

My codes are like this ;

String pastTenseVerb = console.readLine ("Enter a verb that is used in past tense "); console.printf ("%s is a verb that is used in past tense",pastTenseVerb);

Can you tell me what problem do ı have ?

Multiple.java
// I've imported java.io.Console for you.  It is stored in a variable called console for you.

String pastTenseVerb = console.readLine ("entered a verb that is in past tense :");
console.printf ("%s is a past tense verb",pastTenseVerb);

1 Answer

cm21
cm21
150,854 Points

Hi there,

  • Looks like you lost/removed the name variable you did in task 1. You still need it to finish task 3.
  • For the pastTenseVerb initialization: you need to call the readLine method, using whatever verb you want to use as an argument.
  • After the two variable initializations, you will need the console to print a statement using both name and pastTenseVerb.
  • If you're still stuck, check out the sample code below. Be sure to replace 'variable1' and 'variable2' with the correct variables.
// I've imported java.io.Console for you.  It is stored in a variable called console for you.

String name = console.readLine("Your name here ");
String pastTenseVerb = console.readLine("Enter a past tense verb (e.g. nailed)");
console.printf("%s really %s this coding exercise.", variable1, variable2);
// replace variable1 and variable2 with the proper variable names!
Craig Dennis
Craig Dennis
Treehouse Teacher

Thanks CJ!

Where you have "nailed" it should be something like "Please enter a past tense verb". The string after console.readLine is the prompt presented to the user. It looks like you knew that, just a typo ;)