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

import java.io.Console; console saying there is an error

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

this is the text shown in the colsole. It says an error has been reaching in parsing. I'm not sure what I am doing wrong.

1 Answer

Gustavo Winter
PLUS
Gustavo Winter
Courses Plus Student 27,382 Points

Hi Ed Peters, i reproduce your code exactly like is here.

The parsing error:

Introductions.java:9: error: reached end of file while parsing                                   
        console.printf("Craig is learning how to write Java\n");                                 
                                                                ^                                
1 error 

When you get a parsing error means that you have a open brackets {.

For fix this problem you have to close the two open brackets in your code.

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 Craig\n");
        console.printf("Craig is learning how to write Java\n");
    }  // < ---- Here is the public static void main end brackets.
} // < -- This is the public class Introductions end brackets.