Solved

java.lang.ClassCastException: java.util.HashMap

Posted on 2006-10-26
3
1,692 Views
Last Modified: 2008-01-09
i am adding like this while adding;while retreving back i am getting java.lang.ClassCastException: java.util.HashMap

resultMap.put(new Integer(0),empDetailObject);
resultMap.put(new Integer(1),empDetailHashMap);
 finalMap.put(new Integer(0),resultMap);    // Is it correct way to add it to finalMap



while  retreving i am doing  like this;


empDetails = (EmpDetails) finalMap.get(new Integer(0));
HashMap empDetailHashMap      = (HashMap) finalMap.get(new Integer(1));
0
Comment
Question by:chaitu chaitu
  • 3
3 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 17810629
Try

Map empDetailHashMap     = (Map) finalMap.get(new Integer(1));
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 17810630
But please post value of

System.out.println(finalMap.get(new Integer(1).getClass());
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17811509
:-)
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now