Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Type mismatch: cannot convert from Object to double

807601May 1 2008 — edited May 4 2008
Hi I am using a HashMap and am getting the following problem.

I'm trying to modify an entry in a HashTable by doing the following:

double value = hashmap.get(stringName); // Error here: Type mismatch: cannot convert from Object to double

hashmap.put(stringName, new Double (amount + value)); // amount is a double

Can you someone tell me how I get around this problem.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 1 2008
Added on May 1 2008
5 comments
3,738 views