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 Local Development Environments Exploring Your IDE Clean up this mess

Receiving a compiler error on Challenge Task 5 of 5 on Messy.

Why am I receiving a compiler error on Challenge Task 5 of 5 on the Messy problem. It compiles without a problem on IntelliJ. Please advise.

Messy.java
public class Messy {
    public static void main(String[] args) {
        System.out.println("one");
        System.out.println("two");
        System.out.println("three");
        System.out.println("four");
        System.out.println("five");

   /* Please comment out this line and
    this line as well with a hotkey that does multi-line commenting*/

        List<String> numberWords = Arrays.asList("six", "seven", "eight", "nine");
        for (String numberWord : numberWords) {
            System.out.println(numberWord);
        }
    }
}
results.txt
/Users/tonkahudson/Library/Java/JavaVirtualMachines/openjdk-16.0.1/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=49790:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/tonkahudson/IdeaProjects/MessyAgain/out/production/MessyAgain Messy
one
two
three
four
five
six
seven
eight
nine

Process finished with exit code 0

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,561 Points

Hi T Hudson

It seems that you are missing the imports. When you run the reformatting the IDE should have refactored the wildcard import into two separate imports.

import java.util.Array;  
import java.util.List;

Your code now will receive a syntax error because it doesn't have the methods imported needed for the code. Once you put those back, it will pass.

Nice work. :) :dizzy:

Hi Jason:

Thanks very much for your input! Unsure why reformatting the IDE didn't yield the refactoring of the imports. I was experiencing some IDE challenges, so I may have used the wrong version of my file, LOL. I'm a newbie and it's clear that you're at level: well-seasoned. I appreciate your timely reply.