• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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