Java Java Basics Getting Started with Java Introduction to Your Tools

Emma Smith
Emma Smith
3,721 Points

It's not printing my name!

I have copied Craig's text and written my code as follows:

import java.io.Console;

public class Introductions {

public static void main(String[] args) {
    Console console = System.console();
    // Welcome to the Introductions program!  Your code goes below here
    console.printf("Hello, my name is Emma");

} }

I then compiled it to create the Introductions.class

But when I type java Introductions into the bottom box, it just shows this:

treehouse:~/workspace$ javac Introductions.java
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
treehouse:~/workspace$ ls
index.html Introductions.class Introductions.java
treehouse:~/workspace$ java Introductions
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
treehouse:

What have I missed?

Fabian Pijpers
Fabian Pijpers
Courses Plus Student 36,584 Points

Maybe you forgot that } at the end to close it up. And as i recall from java it a go it was System.console.printline("Hello, my name is Emma"); Look at that.

1 Answer

Steven Parker
Steven Parker
204,000 Points

Did you perhaps forget to save your editing changes (with the menu or Ctrl-S shortcut) before recompiling?

If that's not it, make a snapshot of your workspace and post the link to it here and we can investigate further.

Emma Smith
Emma Smith
3,721 Points

Yes! I forgot to save! Thanks so much. I remembered and went back to save, but I didn't compile again so it still wasn't working! So I started again and saved BEFORE compiling and it worked a treat - thanks so much!