casting Object to Date
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   iirr_sgsr
Posted On:   Thursday, November 15, 2007 01:43 PM

I have a
HashMap
I call the get(key) method and this method returns me the Object type.
A field which is Date type whose key is DATE_KEY and when i call get(DATE_KEY) it returns me the Object type but I need to convert it to Date and when i cast it, I get classcast exception. Any clue/solution pls?

Line 1. xxx = xxx.get(DATE_KEY);

xxx.get(DATE_KEY).getClass(),getName() says it is a Date type but when I cast it to date in line 1, it throws classcast exception.

Re: casting Object to Date

Posted By:   Robert_Lybarger  
Posted On:   Thursday, November 15, 2007 07:32 PM

You wouldn't be confusing java.util.Date vs. java.sql.Date, would you?
About | Sitemap | Contact