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

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?