java.io.Serializable
, and java.lang.Comparable
.public enum Color implements Runnable {A sample test program to invoke this run() method:
WHITE, BLACK, RED, YELLOW, BLUE;
public void run() {
System.out.println("name()=" + name() +
", toString()=" + toString());
}
}
for(Color c : Color.values()) {Or,
c.run();
}
for(Runnable r : Color.values()) {
r.run();
}
No comments:
Post a Comment