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 trialvictor ghosh
724 PointsWhat the **** is the answer? I have tried, cant get it, and the help thing is not understandable!!
i
// I have setup a java.io.Console object for you named console
String firstName = ("victor");
printf ("%s can code in Java", firstName);
1 Answer
Justin Horner
Treehouse Guest TeacherHello Victor,
There are two issues causing your code to fail the challenge.
- To create a string variable, you only need the string literal in quotes. Remove the parenthesis so that it is
String firstName = "victor";
- printf is available via System.out so you'll need to prefix the method as such.
System.out.printf("%s can code in Java", firstName);
With these changes the code will compile succesfully and you should pass the challenege.
I hope this helps.
andren
28,558 Pointsandren
28,558 PointsWhile the code will indeed compile successfully it won't actually pass the challenge. The code checker for this challenge is quite picky, it does not accept
printf
statements that have a space between the method and the parenthesis. So you actually have to remove it like this:In order to pass the challenge.
Justin Horner
Treehouse Guest TeacherJustin Horner
Treehouse Guest TeacherThanks andren, I've fixed the typo in my answer.