This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

importance of formal type parameters?  RSS feed

 
Roshan Rai
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


what is the importance of formal type parameters..??

why are they used..??



please help...
thanks in advance..
 
Ankit Dan
Ranch Hand
Posts: 47
Eclipse IDE Java MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suppose you have a non-generic method

now this is too general in the sense that it does not express any relationship between k and array this kind of dependency can be achieved using formal type parameter



so now when a generic method is called you can specify the E as you wish like Integer and hence k and array will be of type Integer, for example


this means the call signature is : iAmGeneric(Integer, Integer[])


i hope you got it

Ankit
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!