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

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

Hi Adam,

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

I your code only the main method is closed

Grigorij