![]() |
[JAVA] Need to add 'double' to hashtable
Here is what i'm working with:
Code:
public class Menu1DB Thanks! -BD |
The Double class is derived from object, you need to use that since Java 1.4- doesn't support putting primitives inside hashtables. Something like
Code:
String strProdPrice = strings.nextToken(); |
a-j hit the nail on the head there. On a side note, it looks like you are adding both the product Id and the price under the same Hash table key. This won't work. Each item in a hash table needs to have a different key. Maybe you should make a "Product" class that holds all the information about a product (Description, Id and Price from what I can see) and store that in your Hash table.
|
All times are GMT -8. The time now is 02:16 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project