Ida Achi wrote:I can understand A and B being correct but F?
F could put a car in the Fruit basket.
F is correct because if we declare class Pie with T, then it can be instantiated with any type, its not bounded.
Ida Achi wrote:Why are T and E not considered correct? Please explain.
Do you mean why C and E are not correct?? C is wrong because if we set Pie class as sub-type of Apple, then line 8 will not compile as Fruit is a superclass of Apple not a subclass. E is syntactically wrong, <T super Apple> is not the correct syntax as super can only be used with ? wildcard...
Why are T and E not considered correct? Please explain.
Ankit Garg wrote :
Do you mean why C and E are not correct??
I think, He, Ida Achi means T and E (the placeholders), which we declare to indicate the generic type in the class or parameter of method. And, Ida Achi, we can use any other Alphabetic character for that. Somebody confirm!
Thanks in Advanced!
|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Joined: Jan 09, 2008
Actually none of them will compile because of the typo near
the end of line 8. And beyond this, answer A also has a typo,
but I know that's not the point . . .
Jim ... ...