Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

? extends Number

 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when we have a List<? extends Number> and use get() to get the elements from the list what do we get? Number or Objects?
 
Ankit Garg
Sheriff
Posts: 9528
32
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try to see what it returns Number or Object??
 
Rajiv Chopra
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Raju Champaklal wrote:when we have a List<? extends Number> and use get() to get the elements from the list what do we get? Number or Objects?

anything extends number.
 
Raju Champaklal
Ranch Hand
Posts: 521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ya i tried....it gave me Number..i tried it after posting the question
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic