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 trialAdinel Berehorschi
1,771 PointsI just cannot compile it, what is wrong?
I get this error every time when I compile it. Why?
Example.java:8: error: no suitable method found for println(String,String)
System.out.println("The dispenser is %s %n",
^
method PrintStream.println() is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(boolean) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(char) is not applicable and so on (Same error, but different primitive types, objects, and classes).
1 Answer
Seth Kroger
56,414 PointsYou want to use printf() instead of println(). println() takes a single string that it prints out straight. printf() takes a format string with placeholders, then arguments whose values are substituted into the placeholders, with as many arguments as there are placeholders.
Michael Swan
1,030 PointsMichael Swan
1,030 PointsMake sure you save both files .