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 trialTejas Pulavarti
Courses Plus Student 654 PointsSomething wrong with the argument
Something wrong with the argument, is there something I have to specify to make the code work.
// I have setup a java.io.Console object for you named console
String firstName = "Me";
console.printf(firstName, "can code in Java");
1 Answer
codebyamir
12,108 PointsHi Tejas,
You'll need to switch the order of your parameters in the printf method and also add a format specifier called %s which tells the method to grab the value of firstName.
console.printf("%s can code in Java", firstName);
Here's the official documentation for reference: https://docs.oracle.com/javase/7/docs/api/java/io/Console.html#printf(java.lang.String,%20java.lang.Object...)
J.D. Sandifer
18,813 PointsJ.D. Sandifer
18,813 PointsThe challenge also asks you to store your name in the variable. Using "Me" as your name would result in the output
Me can code in Java
. That's not quite right. Use your name as directed to generate a grammatically correct sentence.And don't forget the exclamation point at the end - you're learning a useful skill and you have every right to be proud of your hard work!