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 trialchase singhofen
3,811 PointsI dont know if i am using the getter correct. my syntax errors are all over the place with minor edits
Okay so now let's add a required display name property. At this time, just use the proper case of the brand. eg: SONY should have a display name of Sony.
Create a constructor that takes the display name. And add a public getter that returns the display name. Give it the name getDisplayName.
package com.example.model;
public enum Brand {
// Your code here
JVC, SONY, COBY, APPLE;
private Brand displayName;
Brand(String name) {
displayName = SONY;
}
public Brand getDisplayName() {
return displayName;
}
}
1 Answer
Trent Christofferson
18,846 PointsYour enums should have parentheses after them with a string inside because:
Brand(String name)
The above means you need to do something like JVC("jvc"), SONY("sony") . . .etc