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 trialDavid Andreasson
228 PointsIO java sting and variables
java basics Challenge task 4 of 4
// I have imported java.io.Console for you. It is a variable called console
String firstNamw= console.readLine("First name ");
console.printf("First name My name is %s\n", lastName);
String secondName = console.readLine("tjenare");
String firstName = "tjenare";
String lastName = console.readLine("last name: ");
console.printf("Last name My name is %s\n", lastName);
String fiveName = console.readLine("tjenare");
String fourName = "tjenare";
1 Answer
Jennifer Nordell
Treehouse TeacherHi there, David! There are quite a few things going on here. First, you set up a variable named firstNamw
instead of firstName
. Note the last letter in the spelling.
Secondly, the challenge does not ask for anything to be passed into the readLine as a prompt. Inside your console.printf statements you are printing out things not asked for by the challenge such as "My name is". Also, you are missing colons. Keep in mind that these strings must match the challenge instructions exactly. This means capitalization, spelling, punctuation, and even spacing.
The ending code for this challenge at step 4 of 4 should be a total of 4 lines long.
Hope this helps, but let me know if you're still stuck! :sparkls:
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi David,
Rather than posting a new question for the same challenge, please reply back to your original question for further help.
You can also try searching the community for previous questions on this challenge.