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

i need help here! challange question for java

i just started this treehouse stuff and its looking preety intresting .i came across some challenge questions and i encountered some difficulties plz i need some help

// I have setup a java.io.Console object for you named console
String firstName = " mark";
console.printf("mark can code in java");

2 Answers

Luciano Bruzzoni
Luciano Bruzzoni
15,518 Points

Hi! I'm not sure if this is what you are looking for, but I think they want you to use the variable you just created, firstName, in the printf function like this:

console.printf(firstName + " can code in java");

So instead of having the same name always showing up (hard coded), you can change the variable and it will print accordingly. That way if you have alot of code that uses the same name in different parts, instead of changing the name for every item, you just change the variable once and done! That's one of the basic uses of variables.

Hope that helped!

thanks Luciano Bruzzoni, i appreciate the help. i have finally past that challange

Luciano Bruzzoni
Luciano Bruzzoni
15,518 Points

Anytime, happy to help! Cheers