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 trialArezki Sadoudi
108 PointsPrint out to the screen using the printf method on console, "First name: " and the user's first name.
How to use it ?Please !
// I have imported java.io.Console for you. It is a variable called console.
String Firstname = console.readLine("what is ur Fname" );
String firstname = "SRI";
console.printf("%s can code in java", Firstname );
console.printf("%s can code in java", firstname );
1 Answer
MUZ140265 Blessing Kabasa
4,996 PointsFirstly you repeated first name twice yet there is need of First name and Last name. Variables do not start with a capital letter. Variables are written in camel case that is instead of leaving a space between two adjacent words, you write the first letter of the second word in capital case e.g. firstName, lastName, programmingForFun etc. try the following code and give me a shout if it helps.
First stage
String firstName = console.readLine("What is your first name: ");
Second stage
String lastName = console.readLine("What is your last name: ");
third stage
console.printf("First name: %s \n", firstName);
fourth stage
console.printf("Last name: %s", lastName);