I am constructing an enum Flower
which contains the fixed set of constants for Flowers as described below. I'm writing it in a separate file and importing it to other classes so that it could be used across my project.
Is it a good practice to write an enum in a separate file in Java. Can someone give me some advice on this.
public enum Flower {
Jasmine(1),
Lotus(2),
Lilly(3),
Sunflower(4),
Tulip(5),
Daria(6);
private int flowerValue;
public Flower(int value) {
this.flowerValue = value;
}
public int getFlowerValue() {
return this.flowerValue;
}
public String getFlowerName() {
return this.name();
}
}