Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Java Build a JavaFX Application Build a Pomodoro App Enums

I'm stuck here, I've tried every possible solution but couldn't pass through. How can I pass this challenge?

This is supposed to be easy but it seems there is some sort of a problem with my constructor. What am I missing here?

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

public enum Brand {
  Jvc,
  Sony,
  Coby,
  Apple;

  private String displayNames;

  Brand(String displayName) {
    displayNames = displayName;
  }

  public String getDisplayName() {
    return displayNames;
  }

}

1 Answer

Try this and see if it works:

public enum Brand {
  Jvc,
  Sony,
  Coby,
  Apple;

  private String displayNames;
  private Brand(){

  }
  private Brand(String displayName) {
    displayNames = displayName;
  }


  public String getDisplayName() {
    return displayNames;
  }

}