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

problem with return type map

 
indu iyengar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

am using java5..I have a method with return type map...
when I declare the method signature in interface it is not showing any error

but if I declare like this it shows the error
set return type as void
we should not declare generics in return type ?
 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try Map<String, Integer> - primitives can't be applied as generic types. Declare the generic type as Integer and the auto-boxing will allow you to add ints to it.
 
indu iyengar
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic