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

Jack Cronin
Jack Cronin
623 Points

Not sure what this stage is asking me

it is telling me to call the printf method on the console and say a sentence which i have done but i cant get to the next stage because it says there is an error which i dont know how to fix.

Name.java
// I have setup a java.io.Console object for you named console
String firstName = "Jack";
console.printf("%s can code Java!\n", firstName);

1 Answer

andren
andren
28,558 Points

Your code is fine but these challenges are very picky about text output, when they ask you for a certain string they expect you to print/return that exact string.

You forgot the "in" part of "<YOUR NAME> can code in Java!" and that is enough for it to mark your code as wrong. If you change it to be exactly what it asked like this:

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

Then you will be able to pass the challenge.