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

Vidit Shah
Vidit Shah
6,037 Points

What's Wrong here? task 2?Java FX

I can't understand where am I going Wrong

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

public enum Brand {
  // Your code here 
  JVC,SONY,COBY,APPLE;
  private String mSony;
  private String mApple;
  private String mCoby;
  private String mJvc;

  Brand(String sony,String apple,String coby,String jvc)

  {
    mSony=sony;
    mApple=apple;
    mCoby=coby;
    mJvc=jvc;
  }

  public String getDisplayName()
  {
    return mSony;
      return mApple;
      return mCoby;
      return mJvc;

  }

}

2 Answers

La Gracchiatrice
La Gracchiatrice
4,615 Points

too many or only return statement in getDisplayName() method

La Gracchiatrice
La Gracchiatrice
4,615 Points
package com.example.model;
public enum Brand {
JVC("JVC"),
SONY("Sony"), 
COBY("Coby"), 
APPLE("Apple");

private String mName;

Brand (String name){
    mName=name;
  }

  public String getDisplayName(){
    return mName;
  }
}
Jordan Bester
Jordan Bester
4,752 Points

Hey i have question about the Private String mName;? I dont understand its purpose?