• 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:

Maps

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
I made this simple program for inserting elements in2 a Map and then displaying the elements of the Map :



THe program does not compile...it gives an error :



Why ? The put() method takes two objects as parameters.
I have converted the primitive values to their respective Object types...still the error ??

Please help...
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sherry

You can't cast from a primitive to an Object. Try creating a new Integer rather than casting, e.g.

Steve
[ August 04, 2005: Message edited by: Steve McCann ]
 
Sherry Jacob
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Steve McCann:
Hi Sherry

You can't cast from a primitive to an Object. Try creating a new Integer rather than casting, e.g.

Steve

[ August 04, 2005: Message edited by: Steve McCann ]




eeeeeeh....what's up doc ? Thanx abunch Steve...it worked. I made an elementary mistake !!
reply
    Bookmark Topic Watch Topic
  • New Topic