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
Amanda Krueger
3,233 PointsPLEASE HELP!! ERROR:cannot find symbol line 22 and 30
I can't get this to compile and I feel like I checked EVERYTHING. Can someone see what I am doing wrong? I get a cannot find symbol on line 22 and 30.
import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.TreeSet;
import com.teamtreehouse.Treet; import com.teamtreehouse.Treets;
public class Example {
public static void main(String[] args) { Treet[] treets = Treets.load(); System.out.printf("There are %d treets. %n", treets.length); Set<String> allHashTags = new TreeSet<String>(); Set<String> allMentions = new TreeSet<String>(); for (Treet treet : treets) { allHashTags.addAll(treet.getHashTags()); allMentions.addAll(treet.getMentions()); } System.out.printf("Hash tags : %s %n", allHashTags); System.out.printf("Mentions : %s %n", allMentions);
Map<String, Integer> hashTagCounts = new HashMap<String, Integer>();
for (Treet treet : treets) {
for (String hashTag : treet.getHashTags()) {
Integer count = hashTagCounts.get(hashTag);
if (count == null) {
count = 0;
}
count++;
hashTagCounts.put(hashTag, count);
}
} System.out.printf("Hash tag counts: %s %n", hashTagCounts); } }
1 Answer
Jordan Powell
Courses Plus Student 5,410 PointsPost your entire code. It could be a problem in a line but it doesnt throw the runtime error until it gets to line 22 and 30