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

chase singhofen
chase singhofen
3,811 Points

console.printf("Last name: %s", lastName);

i cant figure out why this cant compile??

i need to print my last name string variable. previous question is same except for print last name instead of first name.thx

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
// I have imported java.io.Console for you.  It is a variable called console.

String firstName = console.readLine();
String lastName = console.readLine();

console.printf("Last name: %s", lastName);

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Hi Chase,

Well, your code is correct, except the code for Task 3 seems to have been deleted?

When working in code challenges, unless explicitly told otherwise by the Task's instructions, all subsequent code for tasks must be added to what you have inputed from previous tasks.

So, just put back in the code from Task 3, and add the code for Task 4 under the previous code, and it will all pass.

Keep Coding! :)
:dizzy:

chase singhofen
chase singhofen
3,811 Points

Thx. I finally got passed it. I'm very unfamiliar with workspace. I've been practicing in NetBeans and eclipse for 6 months or so.