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 Meet Objects Final

Example.java:10: error: <identifier> expected

System.out.printf("It was %s but Chris switched it to %s %n", before,
^
Example.java:10: error: illegal start of type
System.out.printf("It was %s but Chris switched it to %s %n", before,

and it continues...

The original code public class Example {

public static void main(String[] args) { // Your amazing code goes here... System.out.println("we are making a new Pez"); Pez dispenser=new Pez("yoda"); System.out.printf("The dispenser is %s %n", dispenser.getName()); } String before=dispenser.swapHead("darth vader"); System.out.printf("It was %s but Chris switched it to %s %n", before, dispenser.getName()); }

Does someone know about this?

Isaiah McGee
Isaiah McGee
1,378 Points

Your code is a little hard to read but i would suggest that you check your curly braces.

if they don't match up it could throw that error.