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 and Variables

When I try to find the result of my code it never works

Whenever I try to on any workspace on any lesson

8 Answers

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Aha! I think the file is not saved. You should choose File>>Save from the editor menu.

Thank you, all I needed to do was save the file

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Is it not compiling when you call javac and you are receiving an error?

No, the result is not showing when I call java

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Hmm... can you attach your code here as well as what command you are running on the command line please? We'll figure it out together!

import java.io.Console;

public class Introductions {

    public static void main(String[] args) {
      Console console = System.console();
      console.printf("Hello, my name is Oluwafemi/n");
      console.printf("Oluwafemi is learning to write Java/n");
  }
}
treehouse:~/workspace$ javac Introductions.java                                                                             
treehouse:~/workspace$ java Introductions                                                                                   
treehouse:~/workspace$
Craig Dennis
Craig Dennis
Treehouse Teacher

One thing to note here is that you have a /n and it should be \n. I don't think this is causing your problem, but you will want to fix that.

Craig Dennis
STAFF
Craig Dennis
Treehouse Teacher

Weird...let's make sure the file is saving correctly. Can you try this on the command line:

treehouse:~/workspace$ cat Introductions.java

It didn't give me the result of my code