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 IO

David Geoffry
David Geoffry
444 Points

I don't understand why it is not reading that I have the "firstName" variable in the printf

idk

IO.java
// I have imported java.io.Console for you.  It is a variable calle

console.printf("First name:%s",firstName);


//First Name

String firstName = "Kelton";


//readline

  String FirstName = console.readLine ("What is your name?");

//Lastname

String lastName = "Rozell";


//readLine

  String LastName = console.readLine ("What is your last name?");

2 Answers

james south
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
james south
Front End Web Development Techdegree Graduate 33,271 Points

you have firstName, but then you also have FirstName. they are different. it wants you to use the camel cased one, but that one doesn't use console.readLine(), so that's one error. you also are referencing the firstName variable before it is declared. your use of the variable must come after it is declared for it to know what you are referencing. same thing with lastName and LastName going on too.