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

Rahul Banker
Rahul Banker
13,603 Points

I am not sure what compiler error I'm making

can someone please check my file and point out the compiler error?

Thanks

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console.readLine ("What is your first name? ");
String lastName = console.readLine ("What is your last name? ");
String lastName = console.readLine ("What is your last Name? ");
console.printf = ("First Name:%s", firstName);

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Make sure you watch the video once again to see how console.println is used.

The error is in this line:

console.printf = ("First Name:%s", firstName);

Hint: you have additional unneeded symbol there, look how console.readLine is used.

Also obviously do not print lastName twice ...

You should also check what errors are there when hitting "Preview" button in code challenge