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!
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
Klaudia Krol
576 PointsChallange 2 printf on console object ??please help
How to propely write down this code challenge as Im stock ?
Console.printf("Klaudia"); - what is incorrect here ?

Klaudia Krol
576 PointsThank you -:) Great help . It works
2 Answers

markmneimneh
14,132 PointsHi
See if this helps:
import java.io.Console;
public class PrintYourName {
public static void main(String[] args) {
Console console = System.console();
// Your code goes below here
String firstName = "Sam";
console.printf("Hello, my name is %s\n", firstName);
}
}
This is an answer that was posted here: https://teamtreehouse.com/community/call-the-printf-function-on-the-console-object-and-make-it-print-out-your-name-can-code-in-java
Moderator Edited: Added markdown to the code so it is readable in the Community Forum. Also changed reply from a 'Comment' to 'Answer,' so it may be upvoted and/or marked as Best Answer.

Kourosh Raeen
23,732 PointsHi Klaudia Krol - Use System.out.printf()
instead of Console.printf()
. Also the challenge is asking you to print the string "Klaudia can code in Java!".
Jason Anders
Treehouse Moderator 145,826 PointsJason Anders
Treehouse Moderator 145,826 PointsCould you provide a link to the actual Challenge. This will make it easier for us to help you troubleshoot. Just copy/paste the URL into a comment here.