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 Java Data Structures Exploring the Java Collection Framework Sets

Cannot figure out why I am getting "Cannot find suitable printf method" error

I am getting the error on the last two print statements.

for( Treet treet : treets ) {
 allHashTags.addAll(treet.getHashTags());
 allMentions.addAll(treet.getMentions());
}
System.out.println("HashTags: %s %n", allHashTags);
System.out.println("Mentions: %s %n", allMentions);
 }

1 Answer

andren
andren
28,558 Points

For formatted strings (strings using %s, and other placeholders like that) you have to use System.out.printf not System.out.println. That is what is causing an error in your code.

Thank you!, that solved the problem.