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

Stuck on IO java first question.

Add a variable to store user's first name using console.readline. Make sure the variable is the Camel Case representation of first name.

IO.java
//I have imported java.io.Console for you.  It is a variable called console.
string firstName=console.readline("what is your name?  ");
string lastName=console.readline("what is your name?  "); 

3 Answers

Michael Hess
Michael Hess
24,512 Points

Hi Rachel,

In Java, when declaring a String variable, the s in String is always capitalized and readLine should be in camel case. Camel Case is a naming convention in which a name is formed of multiple words that are joined together as a single word with the first letter of each of the multiple words capitalized so that each word that makes up the name can easily be read. The name derives from the hump or humps that seem to appear in any camelCase name.

// task 1
String firstName = console.readLine("What is your first name?");
// task 2
String lastName = console.readLine("What is your last name?");

If you have any other questions feel free to ask!

Thanks that actually worked, Thanks a Bunch!!!

Edith England
Edith England
4,270 Points

Apologies, I initially put this as a comment. Adding it as an answer.

Hi Rachel.

Looks to me that the issue is that you haven't capitalised a couple of things:

String should have a capital S and readLine has a capital L in the middle.

Hope you've now sorted this out and moved on. I remember that the insistence on correct capitalisation really threw me at first with Java, but now I can see how it actually makes a lot of sense and I quite like it.

Hth.

Edith

Thank you

String firstName =console.readLine("Ary"); String lastName =console.readLine("de Oliveira");