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 Build a JavaFX Application Build a Pomodoro App The Model

Tomas Verblya
Tomas Verblya
1,998 Points

Cannot 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
Steven Parker
231,275 Points

Could it be that "Jvc" should be "JVC" (all upper case)?

Tomas Verblya
Tomas Verblya
1,998 Points

I thought I tried switching them... perhaps I did not. was a long day :D

Tomas Verblya
Tomas Verblya
1,998 Points

When 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
Steven Parker
231,275 Points

Exactly what you had the first time, except for putting "JVC" in all capital letters.

Jasmeet Singh
Jasmeet Singh
20,145 Points

String passed "Jvc" should be all upper cased. try passing "JVC" instead.

Steven Parker
Steven Parker
231,275 Points

Is there an echo in here? :smirk: