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

Adam Wolfson
Adam Wolfson
159 Points

Too many correct answers.

I find that there are lots of possible answers to the fist two questions. I assumed this was because It kept mistaking things like "First Name:" as my name, so I made it as unspecific as possible and yet again got it correct. The problem though, lies in the third question which I cannot get right at all. I am not sure what to do for the third question, which is possibly because I am getting the first two questions wrong as well. Can I please have a little direction on what to do?

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

2 Answers

Vidhya Sagar
Vidhya Sagar
1,568 Points

Actually there is a method called printf() in the java.io.Console . The f in printf,stands for format specifiers.The key Format Specifiers are %s for strings and %d for intergers. These sepecifers replace the string and integers when given inside printf. So in the third challenge ,you will have to use console.printf("First name:%s",firstName);And similarly for the last challenge as well.These are key concepts which will be used in every possible code of java .So i suggest you take some time in understanding these concepts in depth.

Adam Wolfson
Adam Wolfson
159 Points

Thank you for your help. I misunderstood the third question, but I got it now.