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

Adam Catiller
Adam Catiller
503 Points

java code error 10

My code seems to be exactly the same as the videos (Video on Java Basics).

My code looks like this:

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 Adam");
    console.printf("Adam is learning how to write Java");

}

But the compiler spits out this:


treehouse:~/workspace$ javac Introductions.java
Introductions.java:10: error: reached end of file while pars ing
}
^
1 error

treehouse

From what I understand, it is the '}' that is wrong. I deleted the '}' on line 9 because I though that was what the video did. Any help on fixing this so I can continue would be much appreciated:)

1 Answer

Grigorij Schleifer
Grigorij Schleifer
10,364 Points

Hi Adam,

you need here one additional } for the class declaration ...

I your code only the main method is closed

Grigorij