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 trialChristopher Wilder
427 PointsWhy is this not working?
Console console = System.console(); String firstName = "Chris"; console.printf("%s can code in Java!", firstName);
// I have setup a java.io.Console object for you named console
Console console = System.console();
String firstName = "Chris";
console.printf("%s can code in Java!", firstName);
4 Answers
Rob Bridges
Full Stack JavaScript Techdegree Graduate 35,467 PointsHey Christopher,
It's because console is already declared and you're trying to declare it again. Since Craig already delcared it one of the errors it is giving is telling you that variable is already defined. You can just delete your line where you create console, and your tests will pass.
Benjamin Keller
20,763 PointsNotice in the comment that the Console object has already been set up and named console.
micram1001
33,833 Points// I have setup a java.io.Console object for you named console
// for challenge task 1 - input name to store in String
String firstName = "Mayk";
// for challenge task 2 - System.out.printf("Mayk can code in Java!");
// for challenge task 3 - use string formatter in place of Name
System.out.printf("%s can code in Java!", firstName);
Jake Nisenboim
3,374 Points// I have setup a java.io.Console object for you named console
String firstName = "Chris";
console.printf("%s can code in Java!", firstName);