I have a class with a list of enums, The enums are passed to a constructor and updated to the toString, but I am not allowed to have an instance variable on the class (part of the requirement). How can I make the enums output like the String without adding an instance?
public enum Other {
GAME_BOY("Game Boy"), MACBOOK("Macbook Pro"), IPHONE("iPhone XS"), LAPTOP("Laptop");
private final String product; //can't have instance variable
private Other(String passed) {
this.product = passed;
}
@Override
public String toString() {
return product;
}
}