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 trialbotan barzan
1,402 Pointswhat is wrong with this code ???
i have done every possible thing but it does not accept it
import java.io.Console;
Console console = System.Console();
String firstName = "botan";
console.printf("my name is %s" , FirstName);
1 Answer
rydavim
18,814 PointsHmm...I'm not sure at which step you're getting stuck, but as a general code challenge hint - it's usually a good idea to do only what they ask for. Sometimes adding extra code, even if it's correct, can cause the challenge to fail.
In this case, you don't need the import
and console
setup lines. They have done that for you already. You should also always use the exact string they suggest in the challenge directions. Java variables are also case-sensitive.
// import java.io.Console; -- they have setup a console for you.
// Console console = System.Console(); -- so you don't need these lines.
String firstName = "botan"; // Looks good here!
console.printf("my name is %s" , FirstName); // FirstName is case sensitive, should be firstName.
// Use the string, "<YOUR NAME> can code in Java!" for part 2 of 3. You don't need formatting for this step.
// For the next part, you'll use string formatting like you're doing above. Just make sure you're using the exact string they ask for. ("%s can code in Java!")
Hopefully that should help you get started, but let me know if you still run into issues and we can walk through a solution. Happy coding!
botan barzan
1,402 Pointsbotan barzan
1,402 PointsExactly , I figured it out and the problem was the extra codes that I wrote which the system didn’t require it from me ! Thanks a lot .