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 trialTomasz Bagiński
3,153 PointsI cant printf my name I make some mistake syntax :/
Hello
I try do what website want's but without good syntax from my site :/
// I have setup a java.io.Console object for you named console
class Name {
public static void main(String[] args){
Console console = System.console();
String firstName = "Tom";
console.printf("%s can code in Java", firstName);
}
}
1 Answer
andren
28,558 PointsFor the basic Java challenges you don't have to include any boilerplate code. In other words you don't need to create a class or method to hold your code, and you don't need to instantiate the console
object yourself. All of that is done for you automatically by the challenge checker.
The only code you need to type is code that will accomplish the exact thing the challenge is asking for. Since the challenge only asks you to create a String
variable to hold your name and to print it out those are the only two lines of code you need.
So these two lines:
String firstName = "Tom";
console.printf("%s can code in Java", firstName);
From your solution is all that is needed to solve this challenge.