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

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,075 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,365 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