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 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,860 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.