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 trialKevin Frostad
3,483 PointsJava challenge Task 3 of 3
I can't see what I'm doing wrong here.
// I've imported java.io.Console for you. It is stored in a variable called console for you.
String name = console.readLine("");
String pastTenseVerb = console.readLine("");
System.out.printf("%s really %s this coding exercise", name, pastTenseVerb);
1 Answer
Cory Madden
7,120 PointsYou want to use console.printf()
Kevin Frostad
3,483 PointsKevin Frostad
3,483 PointsI see... Do you mind explaining why it doesn't work with .out? Whats the difference?
Kevin Frostad
3,483 PointsKevin Frostad
3,483 PointsI tried this:
String name = console.readLine("Name: "); String pastTenseVerb = console.readLine("past tense verb: "); System.printf("%s really %s this coding exercise", name, pastTenseVerb);
still doesn't work. Error message:
JavaTester.java:118: error: cannot find symbol System.printf("%s really %s this coding exercise", name, pastTenseVerb); ^ symbol: method printf(String,String,String) location: class System 1 error
Cory Madden
7,120 PointsCory Madden
7,120 PointsSystem.printf("%s really %s this coding exercise", name, pastTenseVerb);
needs to be
console.printf("%s really %s this coding exercise", name, pastTenseVerb);
The task wants you to use the console object to print them out.
Kevin Frostad
3,483 PointsKevin Frostad
3,483 PointsOkay, thank you! Guess I'll get in on the differences later on :)