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 trialLeslie Kingseed
Courses Plus Student 2,316 PointsWhat am I doing wrong? sring firstName; firstName=console.Readline("Leslie");
What am I doing wrong?
sring firstName; firstName=console.Readline("Leslie");
6 Answers
Steven Parker
231,269 PointsCody was right about watching out for spelling, but that must also include upper and lower case. Readline is not the same as ReadLine.
Don't be confused by Krzysztof - I think he might have been giving you advice for a different challenge entirely (perhaps from a different course)!
Now in this challenge, the first step is to Declare a variable named firstName and initialize it to the string returned from a call to Console.ReadLine(). You were very close, you just forgot that ReadLine takes input from the keyboard, not from a parameter. So just leave that out and you'd have:
string firstName; firstName=console.ReadLine(); // notice no value passed to ReadLine
Which is fine, but you can also combine the declaration and assignment together like this:
string firstName = console.ReadLine();
Krzysztof Kucharzyk
Front End Web Development Techdegree Student 4,005 PointsFirst things first, correct your spelling: Sring -> replace with String. Then you have to declare a variable firstName and store your name in it:
This is task 1:
String firstName = "Leslie";
Then call the print function (Task 2):
String firstName = "Leslie";
console.printf("Leslie can code in Java!");
Cody Hansen
5,517 PointsOops! Just a bit of a spelling error. Happens to us all! Sring should be spelled string.
Leslie Kingseed
Courses Plus Student 2,316 PointsThanks.
Vikrant Bhosale
Courses Plus Student 2,680 Pointsstring firstName = Console.ReadLine();
string firstName = Console.ReadLine();
Christoffer Horneland
4,627 Pointsstring firstName = Console.ReadLine(); Console.WriteLine("firstName");