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

Hi there! I have troubles with printing out the string:

String firstName = "Ksenia"; console.printf("%s", firstName);

2 Answers

Hunter Dishner
Hunter Dishner
15,086 Points

Theres a couple things that could go wrong. Is console defined correctly? If it isn't or if you want to validate that the %s and variable firstName is set and functioning then try to do a System.out.println("%s", firstName); or something. However, I'm unsure of the "%s" that's only needed when you are printing out a string with a variable inside the string.

Type it like System.out.println(firstName);

You're thinking like System.out.println("My first name is %s", firstName);

If i've missed your question or just didn't understand it myself let me know!

Tried your code in the challenge, it passed succesfully.