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 Enums

Akshay Ramdasi
Akshay Ramdasi
14,065 Points

build a fx application

cant complete the challenge! Help me resolve this

com/example/model/Brand.java
package com.example.model;


public enum Brand { JVC("JVC"), SONY("Sony"), COBY("Coby"), APPLE("Apple");

public String nName;

Brand(String Sony) {
    nName = Sony;
}

public Brand getName() {
    return nName;
}

1 Answer

I'm assuming you need help with part two. Let me know if this is not the case.

Great use of camelCase to differentiate the member variables. Them being called 'member' variables is why we use an m and not an n :) - Easy mistake to make.

I'd use 'brand' or something similar here instead of 'Song' personally, I feel that it makes things confusing

Brand(String Sony) {
    nName = Sony;
}

BECOMES

Brand(String brand) {
    mBrandName = brand;
}

You are not able to pass the test because you are not doing what the question asks of you - Don't return a 'Brand' datatype, return something else :) It's not too complicated this one, it's just a simple getter.

Also, make sure that it is name as the task requests :)

Good luck!

Akshay Ramdasi
Akshay Ramdasi
14,065 Points

I got the answer:

      package com.example.model;

public enum Brand {
    JVC("JVC"),
    SONY("Sony"),
    APPLE("Apple"),
    COBY("Coby");

    private String mDisplayName;

    Brand(String displayName) {
        mDisplayName = displayName;
    }

    public String getDisplayName() {
        return mDisplayName;
    }
}