ayub aliPro Student 723 Points
anyone can help me with this i will appreciate
// I've imported java.io.Console for you. It is stored in a variable called console for you. String name=console.readLine("name"); String pastTenseVerb=console.readLine("past Tense Verb"); String realy=console.readLine("realy"); console.printf("%s",name); console.printf("%s",pastTenseVerb); console.printf("%s",realy);
Steve HunterTreehouse Moderator 55,877 Points
The first two lines are prompting the user to enter a name then a past tense verb and storing that input in the two named variables. Something like:
String name = console.readLine("Enter your/a name: "); String pastTenseVerb = console.readLine("Enter a past tense verb: ");
After that, you want to output a string using what the user just entered, which is stored in your two variables. To do this, you use the
%s placeholder where you want to insert the contents of that variable. You can do this multiple times - but you must pass in the right number of variables after the string to fill all the placeholders.
The string is
"<name> really <ptverb> this coding exercise". So, instead of the two variables, switch those for
%s. Then, after the string, pass in
name first, then
pastTenseVerb. That looks like:
console.printf("%s really %s this coding exercise", name, pastTenseVerb);
I hope that makes sense.