• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Self Written Code on Generic Problem

 
Ranch Hand
Posts: 114
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys, Please me out to clearing following Generic Problems. Here is the code written by me :

Similar code Here but with little modification from Line-1


I could not understand that when i removed '<E extends C>' from the line-3 the code on line-4 doesn't compile. why??
what is the use of '<E extends C>' ?
Please clarify my doubts.

 
Ranch Hand
Posts: 394
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Aashu wrote:I could not understand that when i removed '<E extends C>' from the line-3 the code on line-4 doesn't compile. why??
what is the use of '<E extends C>' ?


In this method:

<E extends C> is a 'fresh' generic type declaration 'SPECIFIC' to the method...Hence You are saying in effect that the generic 'TYPE' 'E' passed in this method should be 'C' and 'SUB-TYPES' of 'C'.
 
reply
    Bookmark Topic Watch Topic
  • New Topic