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 IO

syntax error

again.. i tried to write the code.. similar with the exercise but i got errors. what should i do ? what's the matter?

IO.java
// I have imported java.io.Console for you.  It is a variable called console.
import java.io.Console;

public class Introductions{

  public static void main (String[] args) {
   Console console = System.console();
  //this is introduction program!
  String myFirstName = console.readLine("Who are you ?  "); 

  //this is camel casing
  console.printf("Hello, this is %s\n", myFirstName);
  console.printf("%s is learning Java Program\n", myFirstName);
  }
}

1 Answer

Borys Zieba
Borys Zieba
669 Points

Hello there,

I have run Your code, and it is working in my workspace.

Are You sure that you have saved changes before runing your code with console ?

/*

treehouse:~/workspace$ javac Introductions.java && java Introductions
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
Picked up JAVA_TOOL_OPTIONS: -Xmx128m
Picked up _JAVA_OPTIONS: -Xmx128m
Who are you ? Becky
Hello, this is Becky
Becky is learning Java Program

*/