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 trialVISHKARMA RAY
Android Development Techdegree Student 42 Pointswhat's wrong with me?
Declare a variable that is named the camel-cased version of "first name". Store the user's first name into this new variable using console.readLine??
// I have imported java.io.Console for you. It is a variable called console.
public class Introduction{
public static void main(String[] args)
{
Console console=System.console();
String firstName=console.readLine("what is your name",firstName);;
console.printf("my name is %s",firstName);
console.printf("%s is learn java",firstName);
}
}
1 Answer
Steve Hunter
57,712 PointsHi there,
You need to take the instructions absolutely literally - there's no need to do anything other than what the challenge requests.
So, this one requires you to create a string variable called firstName
that holds your name and takes user input:
String firstName = console.readLine("What's your first name?: ");
Done!
It doesn't ask for a main method or any output (yet!) - just the one variable is all that's needed in the first task.
Steve.