dcsimg
alpha or numeric?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Shaz_Rose
Posted On:   Tuesday, August 21, 2001 11:18 PM

How will I know that the data I am getting in a hashtable is numeric or alpha? Please reply ASAP. Thanks.

Re: alpha or numeric?

Posted By:   Bogdan_Sheptunov  
Posted On:   Wednesday, August 22, 2001 08:36 AM

The data in hashtable is always an object. You cannot store an int there, you have to use the wrapper class Integer, and so on.



Once you retrieve your object, you can try casting it to the different types, like




Object anObject = aHashtable.get(theKey);


if (theKey != null)


{


    if (anObject instanceof Integer)


    {


    
// do your logic for Int there, starting from ((Integer)anObject).intValue()


    }


}





Hope this helps.
About | Sitemap | Contact