How to get Enum Value from index in Java? -



How to get Enum Value from index in Java? -

i have enum in java:

public enum months { jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec }

i want access enum values index, e.g.

months(1) = jan; months(2) = feb; ...

how shall that?

try this

months.values()[index]

java enums

Comments

Popular posts from this blog

c# - Move local mssql database to webhosted MYSQL -

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -