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!
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

Terence Evans
1,870 PointsMessy project
When I run the "Messy" project at the end of the lesson I get the message "Are you sure you ran the reformat code action? This seems suspect: import java.util." I did run the "reformat code" action (many, many times and even restarted the whole F&%ing thing and am not able to get through this bottleneck.
8 Answers

Mike Hagedon
16,478 PointsFrom the Treehouse Markdown Cheatsheet: "wrap your code with 3 backticks (```) on the line before and after. If you specify the language after the first set of backticks, that'll help us with syntax highlighting."

Mike Hagedon
16,478 PointsCheck on step 5 of the challenge to see if line 1 still has the code
import java.util.*;
If so, get rid of it.

Terence Evans
1,870 PointsThanks Mike. I tried removing the "import java.util.*;" but get "java: cannot find symbol..." error messages when I run the program.

Mike Hagedon
16,478 PointsHi Terence, I was assuming your copy and paste had introduced two import java.util.*
lines. Since that's not the case, I'm not sure what to tell you. Can you paste the code you're running through the checker?

Terence Evans
1,870 PointsSure Mike. Here goes. import java.util.*;
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"); System.out.println("six"); System.out.println("seven"); System.out.println("eight"); System.out.println("nine");
/*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) {
// Use the sout shortcut to write out numberWord;
System.out.println(numberWord);
}
}
}

Terence Evans
1,870 PointsOh sorry. I forgot how to make a better copy of the screen. Can you help me there too? I know, I'm being a pain.

Terence Evans
1,870 PointsJava language
import java.util.*;
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");
System.out.println("six");
System.out.println("seven");
System.out.println("eight");
System.out.println("nine");
/*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);
}
}
}
Thanks for your help and understanding

Mike Hagedon
16,478 PointsAh, delete the System.out.println()
calls for six, seven, eight, and nine. Let the for loop handle that.

Terence Evans
1,870 PointsThanks. I removed the last line and ran it then when I checked it and still get the message "Are you sure you ran the reformat code action? This seems suspect: import java.util.*"

Mike Hagedon
16,478 PointsWhat does your code currently look like?

Terence Evans
1,870 Pointsimport java.util.*;
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");
System.out.println("six");
System.out.println("seven");
System.out.println("eight");
System.out.println("nine");
/*Please comment out this line and
this line as well with a hotkey that does multi - line commenting*/
List<String> numberWords;
numberWords = Arrays.asList("six", "seven", "eight", "nine");
for (String numberWord : numberWords) {
}
}
}

Mike Hagedon
16,478 PointsAh, you'll want to restore the System.out.println()
line in the for loop. I meant for you to delete the earlier System.out.println()
lines above that that have the literal strings "six", "seven", "eight", and "nine". ;-)

Terence Evans
1,870 PointsArgh. I'm still getting the message "Bummer! Are you sure you ran the reformat code action? This seems suspect: import java.util.* Here is my code.
import java.util.*;
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");
System.out.println("six");
System.out.println("seven");
System.out.println("eight");
System.out.println("nine");
/*Please comment out this line and
this line as well with a hotkey that does multi - line commenting*/
List<String> numberWords;
numberWords = Arrays.asList();
for (String numberWord : numberWords) {
System.out.println(numberWord);
}
}
}
and here are my results
"C:\Program Files\Java\jdk1.8.0_121\bin\java" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.1.1\lib\idea_rt.jar=64792:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.1.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_121\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_121\jre\lib\rt.jar;C:\Users\Owner\IdeaProjects\Messy\out\production\Messy" Messy
one
two
three
four
five
six
seven
eight
nine
Process finished with exit code 0
I'm ready to take up something less challenging like brain surgery. I sure appreciate your help with this.

Mike Hagedon
16,478 PointsRestore the line numberWords = Arrays.asList("six", "seven", "eight", "nine");
and remove the lines
System.out.println("six");
System.out.println("seven");
System.out.println("eight");
System.out.println("nine");

Terence Evans
1,870 PointsSon of a %^&# I finally got it. As I was hovering over the first line, I got a little light-bulb that had an option come up that inserted a line (why not try it?) so I did. The line (above import java.util.List; now reads import java.util.Arrays; I'd sure like to know why "Reformat Code" didn't catch it when Craig seemed to think it would. OK. Thank you a thousand times over.

Mike Hagedon
16,478 PointsHuh, I didn't think this exercise was concerned with expanding the java.util.*
out into explicit imports, but maybe I'm forgetting. In any case, congratulations!
It's not uncommon to have these sort of wish-I-had-thought-of-that-sooner moments in programming, even after years of experience. So hang in there!