Reputation: 35
I have a requirement in which I need to create a comb box containing floating point values like JBoss 4.2.3, JBoss 6.2 etc
I tried like below
public enum JBossVersion {
UNKNOWN, JBOSS 4.2.3, JBOSS 6.2
}
But I get error each time saying ";" ,"," ,"}" expected
Can you guys help me how to proceed this further? If there is any approach please guide me. Thanks
Upvotes: 2
Views: 250
Reputation: 6946
You can use private values in enum:
public enum JBossVersion {
UNKNOWN(""),
JBOSS_4_2_3("4.2.3"),
JBOSS_6_2("6.2");
private String version;
private JBossVersion(String version) {
this.version = version;
}
public String getVersion() {
return version;
}
}
And usage JBossVersion.JBOSS_4_2_3.getVersion()
Upvotes: 6