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

wats the error

What is the error here ?

Name.java
// I have setup a java.io.Console object for you named console
public class Name {

  public static void main(String[] args) {
    Console console = System.console();
    String firstName = "Senthilkumar";
    console.printf("Hello my Name is" %s, firstName);
  }
}

2 Answers

Dane Parchment
MOD
Dane Parchment
Treehouse Moderator 11,003 Points

You need to capitalize the C in console, this is a java keyword/variable and based on those conventions you must spell them exactly the way they are shown, including the capitalization.

Grigorij Schleifer
Grigorij Schleifer
10,363 Points

Hi there,

you don´t need this code block:

public class Name {

  public static void main(String[] args) {
    Console console = System.console();

it is already defined for you ...

And put the second " after the string formatter %s, so the comipler knows where to "inject" your value of the firstName

The code can look like this:

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

    String firstName = "Senthilkumar";
    console.printf("Hello my Name is %s", firstName);

Grigorij