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 ) {
System.out.println("HashTags: %s %n", allHashTags);
System.out.println("Mentions: %s %n", allMentions);

1 Answer

28,463 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.