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 trialTomas Verblya
1,998 PointsCannot pass the problem with enums.
Hello.
For some reason the exercise task 2 doesn't pass. It says that it expected to get the display name of JVC, but it didn't. What am I missing here?
package com.example.model;
public enum Brand {
JVC("Jvc"), SONY("Sony"), COBY("Coby"), APPLE("Apple");
private String mDisplayName;
Brand(String brand) {
mDisplayName = brand;
}
public String getDisplayName() {
return mDisplayName;
}
}
3 Answers
Steven Parker
231,184 PointsCould it be that "Jvc" should be "JVC" (all upper case)?
Tomas Verblya
1,998 PointsWhen doing it like this " Jvc("JVC"), Sony("SONY"), Coby("COBY"), Apple("APPLE"); " I get an error, Expected enum to contain value 'JVC' but it did not. Please add it.
I had to pass it like this to get it working:
JVC("JVC"), SONY("Sony"), COBY("Coby"), APPLE("Apple");
Steven Parker
231,184 PointsExactly what you had the first time, except for putting "JVC" in all capital letters.
Jasmeet Singh
20,145 PointsString passed "Jvc" should be all upper cased. try passing "JVC" instead.
Steven Parker
231,184 PointsIs there an echo in here?
Tomas Verblya
1,998 PointsTomas Verblya
1,998 PointsI thought I tried switching them... perhaps I did not. was a long day :D