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

Why is it showing me a error on "console.stringf" ?

Hello, i get this error but i don't see anything wrong in my code. The arrow is pointing on the dot in "console.stringf".

JavaTester.java:118: error: cannot find symbol console.stringf("%s really %s this coding exercise.",name,pastTenseVerb); ^ symbol: method stringf(String,String,String) location: variable console of type MockConsole 1 error

Multiple.java
// I've imported java.io.Console for you.  It is stored in a variable called console for you.
String name = console.readLine("What's your name?  ");
String pastTenseVerb = console.readLine("Choose a past tense verb:  ");
console.stringf("%s really %s this coding exercise.",name,pastTenseVerb);

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

Hi Damian,

You're on the right track, but the console does not have a method named stringf, which is why the compiler is throwing that error. The instructions are asking you to output the formatted string, so the method you're needing is called printf.

Other that that, great job! :) :dizzy: