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

Error while running correct code.

Unable to solve the question "Call the printf method on the console object and make it write out " can code in Java!" ?"

My Code - String firstName = "Pawan"; console.printf("First Name : %s", firstName);

Error - Bummer! Check the spelling of your argument to the printf method. Make sure it is printing out what the instructions are asking for.

4 Answers

Almost there but you put "First Name: " where it wants you to say " can code in Java!" So do this,

String firstName = "Pawan"; console.printf("%s can code in Java!", firstName);

Thanks i get it..

I have tried the Brandon's code but unfortunately i got the same error and also in Eclipes facing error too.

Check the spelling, the spelling must be exact

Thanks Brandon but I am sure as please check the code import java.io.Console; public class MyConsole { public static void main(String[] args) { String firstName ="Alex"; Console console = System.console(); console.printf("%s can code in Java!", firstName);
} }

I have never seen anyone construct a console as you do here. The printf comes straight from the System object. "System.out.printf("%s can code in Java!", firstName);". You do not need to import or declare a console object.

The other problem could be that you are using the name Alex which does not match your name of Saifaldeen, and treehouse is checking against that name.