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 Java Basics Getting Started with Java Strings, Variables, and Formatting

What is wrong in the codes...

The system told me the argument is not correct. But I cannot find the problem. Thank you for your help.

String firstName="Don"; console.printf("Hi, my name is %s\n",firstName);

Name.java
// I have setup a java.io.Console object for you named console
String firstName="Wendy";
console.printf("Hello, my name is %s\n",firstName);

it would be helpful if you were more specific about what "console" is. If you are just trying to print something to the Output then in java you would write

ยดยดยด System.out.println(-----); ยดยดยด

3 Answers

Axel McCode
Axel McCode
13,869 Points

The challenge was asking you to print out " 'YOUR NAME' can code in Java!", so all that was wrong with your code was that your output was not the one the challenge asked you to print to the console. The following code shows correct way to do this.

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

Hope this helps :)

Thanks a lot, Axel :)

Axel McCode
Axel McCode
13,869 Points

No problem, glad I could help! :)

Thanks that help me too