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 trialTed Clayton
Courses Plus Student 206 PointsWhere am i messing up with Challenge Task 3 of 4?
Using the console's printf method, display a message that says, "First name: ", followed by the first name that the user has entered. My code is console.printf("First name:", Teddy); the error message I got was : JavaTester.java:130: error: cannot find symbol console.printf("First name:", Teddy); ^ symbol: variable Teddy location: class JavaTester 1 error
// I have imported java.io.Console for you. It is a variable called console.
String firstName = console.readLine("Teddy");
String lastName = console.readLine("Clayton");
console.printf("First name:", Teddy);
2 Answers
Daniel Marin
8,021 PointsHi Ted Clayton , Here's what you need to fix:
console.printf("First name: %s", firstName);
You need to add %s and the variable name firstName
The %s is replaced by firstName in the console message.
Ted Clayton
Courses Plus Student 206 PointsDaniel, Thank you for the help man. I greatly appreciate it.