aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Can we super in class type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Can we super in class type" Watch "Can we super in class type" New topic
Author

Can we super in class type

Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
class Pie<T super Apple>{
Can we super in class type?
I am having doubt on it and nowhere i found whether i can or not. I know its a simple one, but i need to know this.
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

Type declarations cannot have super or wildcards<?> class or method both.


[ SCJP 6.0 - 90% ] , JSP, Servlets and Learning EJB.
Try out the programs using a TextEditor. Textpad - Java 6 api
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804
    
    1

It is illegal. Give me an example where it could be useful. Only with wildcard "super" is legal.


SCJP6, SCWCD5, OCE:EJBD6.
BLOG: http://leakfromjavaheap.blogspot.com
Nitish Bangera
Ranch Hand

Joined: Jul 15, 2009
Posts: 537

legal ok but not for declaring types for the class and methods.
Rajesh k Jha
Ranch Hand

Joined: May 10, 2009
Posts: 72
Thanks to all, now i got that <T super ..> cant be used with class type
and <?> cant be used with Generic method and Class declaration type...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we super in class type