Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Java Basics Getting Started with Java Strings, Variables, and Formatting

error in my program

i dont know why is it showing errors every time? please help me to find any silly mistakes in my code.

// I have setup a java.io.Console object for you named console
import java.io.Console;

  public class Name {
    public static void main(String[] args) {
      Console console = System.console();
  String firstName = "Sudipta";
  console.printf("My name is %s",firstName);

4 Answers

Hi The challenge asks you to put make it write out "<YOUR NAME> can code in Java!"
but you wrote your code like console.printf("My name is %s",firstName);
so just get rid of "My name is" and put " can code in Java!"

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

In addition to Thayer Y's answer, I'd point out that in these challenges it's important to not do anything not explicitly asked for by the challenge. You've set up a class and a main function and imported something. None of these were asked for and have already been provided by the challenge. They very literally only want the lines asked for. Also, as Thayer points out, you would be printing the incorrect string.

Hope this helps! :sparkles:

still showing error.

i understand now..i just have to write the particular code what they are asking,not full program.