Best way to implement an enum class in java -
i'm trying best way implement file static enums, without using getters , setters, static info, achieve in php in example below, need getters , setters in java?
final class enumtrade { const buy = 1; const sell = 2; } final class enumgender { const male = 1; const female = 2; } final class enumhttpmethod { const = 1; const post = 2; }
public enum enumtrade { buy, sell }
and on.
edit: if number matters, do:
public enum enumtrade { buy(1), sell(2) }
Comments
Post a Comment