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 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.

Name.java
// 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
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
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.