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 Objects (Retired) Meet Objects Creating Classes

Any help with my coding problems?

Every time I compile this specific chunk of code in the console it says that System.out.print(lnl/f) is incorrect. It may be easier if you see the error script:

Example.java:7: error: '(' or '[' expected                    
        System.out.printf("The dispenser character is %s\n"'  
        ^                                                     
Example.java:7: error: illegal start of expression            
        System.out.printf("The dispenser character is %s\n"'  
                    ^                                               
Example.java:7: error: ';' expected    
        System.out.printf("The dispenser character is %s\n"'  
                          ^                                           
Example.java:7: error: illegal line end in character literal  
        System.out.printf("The dispenser character is %s\n"'  
                                                           ^ 
Example.java:7: error: '(' or '[' expected                    
        System.out.printf("The dispenser character is %s\n"'  
        ^                                                     
Example.java:7: error: illegal start of expression            
        System.out.printf("The dispenser character is %s\n"'
                    ^                                               
Example.java:7: error: ';' expected                           
        System.out.printf("The dispenser character is %s\n"'  
                          ^                                           
Example.java:7: error: illegal line end in character literal 
        System.out.printf("The dispenser character is %s\n"'  
                                                                                             ^  
Example.java:8: error: not a statement                        
Example.java:7: error: '(' or '[' expected                    
        System.out.printf("The dispenser character is %s\n", 
        ^                                                     
Example.java:7: error: illegal start of expression            
        System.out.printf("The dispenser character is %s\n",  
                    ^                                               
Example.java:7: error: ';' expected                           
        System.out.printf("The dispenser character is %s\n",  
                          ^                                         

Here is the code

public class Example {

    public static void main(String[] args) {
     System.out.println("We are making a new Pez Dispenser.\n");
     PezDispenser dispenser = new PezDispenser
     System.out.printf("The dispenser character is %s\n",
                          character.mCharacterName);
    }
}

I edited your post with some syntax highlighting to make it a little easier to follow. This post has info on how to do it if you're curious.

2 Answers

Alejandro Crespo
Alejandro Crespo
6,628 Points

PezDispenser dispenser = new PezDispenser(); you forgot the parenthesis and semicolon

Oh i am sorry the indicators switched back to the left side