Surfing on the source code of Java, I found the following declaration:
public abstract class Enum<E extends Enum<E>>
How should it be interpreted? I’m stuck with it…
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s like quining! @LES2 is on the right track.
If you have the following class:
then the magic that these recursive templates gives you, is that:
Footemplate requires that its parameter extends itself (Foo).E, in turn, extendsFoo<E>(it has to because of the previous point) then you have ensured that theFootemplate has an “awareness” of its subclass, since its subclass is passed into it as a template parameterFoo‘s methods can safely downcast thethispointer to its derived subclassE.