aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes question about the generic methods : ExamLab final test Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "question about the generic methods : ExamLab final test" Watch "question about the generic methods : ExamLab final test" New topic
Author

question about the generic methods : ExamLab final test

Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

I am unable to interpret the meaning of the following code



I am not able to understand what the statement

means
what I know is this
1. This is generic method
2. that can be passed any instantiation which can be <T extends E>
3. Its return type is A

but I am not able to understand what <? super T> means after A

please help me

SCJP 6 [86%], OCPWCD [84%], OCEJPAD [83%]
If you find any post useful, click the "plus one" sign on the right
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9317
    
  17

There is a generic type declared in the GenClass which is E. E can be any class which extends A (or A itself). In the method declaration you declare another type T which extends E (E in itself is A or its subclass). The parameter the method gets is A<? super T>. This means that the method will receive an instance of A which has a type of T or a super class of T. To make this simpler to understand, lets replace A with a class from the Java API
The method parameter and return type are now easier to understand (I hope)...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Prasad Kharkar
Ranch Hand

Joined: Mar 07, 2010
Posts: 446
    
    1

of course they are easier now
after this nice explanation
thanks a lot
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question about the generic methods : ExamLab final test