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 trialLyoid Mudikanwi
4,146 PointsNow finally after running your code, please paste it in the Messy.java file and the results from the console in the resu
I have done everything expected but l am still getting an error
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");
/* 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);
}
}
}
Now finally after running your code, please paste it in the Messy.java file and the results from the console in the results.txt tab.
one
two
three
four
five
six
six
seven
eight
nine
4 Answers
Steven Parker
231,236 PointsThe reformat should have converted the line with the wildcard into two discreet imports:
import java.util.Arrays;
import java.util.List;
Also, the instructions say "Make sure you run the code and that it counts from one through nine correctly.". But your output has two "six" lines.
And finally, it looks like the final instruction text got into the code area.
Dinu Comendant
6,049 PointsWhy is it necessary to have written down Arrays and List? What's wrong with * ? I feel like the course is making it feel like a bad thing.
Pushpa Raj Dangi
Full Stack JavaScript Techdegree Student 5,246 PointsYou have repeat six twice. My soln is :
import java.util.Arrays;
import java.util.List;
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) {
// Use the sout shortcut to write out numberWord;
System.out.println(numberWord);
}
}
}
Jorge Baptista
616 Pointsimport java.util.Arrays; import java.util.List;
import java.util.Set; import java.lang.Iterable;
public class Messy {
public static void main(String[] args){
System.out.println("five");System.out.println("one");
System.out.println("six");
System.out.println( "four" );
System.out.println("two");
//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(numberWords);
}
}
}
Lyoid Mudikanwi
4,146 PointsLyoid Mudikanwi
4,146 Pointsto those going to help please ignore the last line which starts with Now finally after running.......IT IS NOT THE PROBLEM. I am getting the following error
Bummer: Are you sure you ran the reformat code action? This seems suspect: import java.util.*