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 Perfecting the Prototype Censoring Words - Looping Until the Value Passes

Problem: reached end of file while parsing

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 her
        String noun = (console.readLine("enter a noun:  "));
        String badWord = ("****");  //Word removed by moderator (inappropriate for the forums).
        if (noun.equalsIgnoreCase(badWord));
            {
              console.printf("don't use that language again");
              String noun = (console.readLine("enter a noun:  "));
                if(noun.equalsIgnoreCase(badWord));
                   {
                     System.exit(0);
                   }
  }
}

where is the problem i got this for error: Introductions.java:20: error: reached end of file while parsing } ^

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,858 Points

(Added Markdown to your code for easier readability in the Community. Please have a look at the Markdown Cheatsheet when posting code)

As for your question. That error pretty much always means that you are missing a closing brace. And, you are missing the one to close out the class. Just add that at the end and it should be good to go.

I'm not sure if it was just how your code copy/pasted, but indentation is very important, especially when you need to check closing braces.

Keep Coding :)

:dizzy: