我正在学习枚举,但我不明白这种方法的目的。
例子:
enum Fruits{
apple, pear, orange
}
class Demo{
f = Fruits.valueOf("apple"); //returns apple... but I had to type it!
// so why wouldn't I save myself some time
// and just write: f = Fruits.apple; !?
}