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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

IIS->Tomcat Redirect: multiple worker with default -