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 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

Chase Marchione
Chase Marchione
155,055 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 ;)