这是泛型限定吗?
还是在说明所有的枚举类都有系统默认继承Enum类?
如果我们定义的枚举类都是默认继承Enum,那么我们定义的所有的枚举类就不能继承其他类了吗?作者: sergio 时间: 2013-8-3 23:35
the declaration " Enum<E extends Enum<E>> " can be decyphered as: Enum is a generic type that can only be instantiated for its subtypes, and those subtypes will inherit some useful methods, some of which take subtype specific arguments (or otherwise depend on the subtype).
搜索后得到的解答,来自stack over flow上面一位哥们的提问解答中的文章讨论此问题。原文地址:http://www.angelikalanger.com/GenericsFAQ/FAQSections/TypeParameters.html#FAQ106作者: 天地有我 时间: 2013-8-4 14:55
//表示的是E类型必须是一个继承自MyEnum类的类型(也就是说是一个MyEnum的子类型和自己本身类型)
class MyEnum<E extends MyEnum<E>> extends ChinesePeople implements MyComparable<E>
{
public int myCompare(E o)
{
return 0;
}
}