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

Challenge Task 3 of 3, replace <YOUR NAME>, formatter.

2 Answers

andren
andren
28,558 Points

The problem is that you are using the equals sign, when calling a method you don't set it equal to the parenthesis, you simply type the method name and then immediately follow it with parenthesis. Also while it won't cause an error you don't need to surround values that you assign to a variable in parenthesis.

The solution to this task looks like this:

String firstName = "Sarah";
console.printf("%s can code in Java", firstName);

And I'm not quite sure what you mean that this wasn't listed in the lesson, the lesson directly preceding this challenge Strings and Variables does use console.printf. And there they show it used in the same way that this challenge requires you to use it.

Call the printf method on the console object and make it write out "<YOUR NAME> can code in Java!", is asked. '<YOUR NAME>' was not introduced. 'firstName' was introduced. The question should be changed for clarity.