per
http://java.sun.com/developer/technicalArticles/releases/j2se15langfeat/
there was an example of implementing enums prior to 5.0 (see below).
In 5.0 you have enum which is sweet for assigning arbitraty values but
I want to assign specific values and gain all of the other benefits of
using an enum...
so I want (can I have...?)
enum ASC {abc=3,ced=4};
and if you look at the cited pre 1.5 example you have that same
flexibility
public class MainMenu {
private final String name;
private MainMenu(String name) {
this.name = name;
}
public static final MainMenu FILE = new MainMenu("file");
public static final MainMenu EDIT = new MainMenu("edit");
public static final MainMenu FORMAT = new MainMenu("format");
public static final MainMenu VIEW = new MainMenu("view");
public String toString() {
return name;
}
}
Roland de Ruiter - 15 Jul 2006 10:41 GMT
> per
> http://java.sun.com/developer/technicalArticles/releases/j2se15langfeat/
[quoted text clipped - 12 lines]
> flexibility
> [...]
public enum ASC {
abc(3), ced(4);
private final int foo;
private ASC(int bar) {
this.foo = bar;
}
public int getFoo() {
return foo;
}
public static void main(String[] args) {
for (ASC asc : ASC.values()) {
System.out.println(asc + ".getFoo()=" + asc.getFoo());
}
}
}
<http://java.sun.com/docs/books/tutorial/java/javaOO/enum.html>

Signature
Regards,
Roland