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

HELLO! I dont know what I'm doing wrong. Could someone explain this problem to me please.

Please if possible explain it in a simple manner what I doing wrong. Thank you

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
String firstName = console. readLine("Wilfried  ");
String lastName = console. readLine("Allico  ");
console.printf("%s\n, firstName");

1 Answer

Rares Conea
PLUS
Rares Conea
Courses Plus Student 15,000 Points

Hi,

First of all the syntax for the print should be console.printf("First name: %s ", firstName); Everything is written between " " will be printed as text on screen and what is after (firstName for example) is the variable that will take the place of %s. If you want to move to the next line i suggest you use %n.

Mannnn thank you so much!! It makes more sense now!