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 trialAbhinav Sharma
421 Pointsthis is showing output.html for Java compilation
??
// I have imported java.io.Console foimport java.io.Console;
Public class Is
{ public static void main (String[] args)
{ Console console = System.console();
String Name = console.readLine("enter your name?");
console.printf("my name is %s" , Name);
}
}
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsHi Abhinav,
If you are on Task one... then there are a few problems happening here.
Challenges and the instructions are very specific and very picky. So, here you have way too much code and don't seem to be following what the instructions are asking for.
The instructions did not ask for a Class to be created, nor a public static void
method, nor did it ask for a printf
. So all these need to be deleted.
Next, all the instructions are asking for is to
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.
While you do have this correct in syntax, you are using the wrong variable name. The Task specifically asks for it to be named firstName
, but you have it named Name
. Which is not what is asked for, but also does not follow Java Naming Conventions. Variable names should never start with an Upper-cased letter. It should always be a lower-cased letter and follow lower camelCase style.
Below is the correct line of code for you to review. Have a look and see what I mean by the above... The correct code for Task one is just one line of code.
String firstName = console.readLine("enter your name?");
Hope this all helps.
keep Coding!