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
Muhamed Asil
7,453 PointsPezDispinser error
Example.java value public class Example {
public static void main(String[] args) {
System.out.println("We are a making a new Pez Dispinser.");
PezDispinser dispiner = new PezDispinser();
System.out.println("The dispiner character is %s\n",
dispiner.mCharacterName);
}
}
PezDispinser.java value public class PezDispinser{ public String mCharacterName = "Asil"; }
and when I type clear && javac Example.java && java Example in console I see this error message
^
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
(actual and formal argument lists differ in length)
method PrintStream.println(int) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(long) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(float) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(double) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(char[]) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(String) is not applicable
(actual and formal argument lists differ in length)
method PrintStream.println(Object) is not applicable
(actual and formal argument lists differ in length)
1 error
1 Answer
Jakob Wozniak
17,896 PointsI think you're mixing up "printf" and "println". If you want to print your answer, you can do it either of these two ways:
System.out.println("The dispiner character is " + dispiner.mCharacterName);
System.out.printf("The dispiner character is %s", dispiner.mCharacterName);
I hope this is clear!