[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

java.lang.ClassCastException: java.util.HashMap

Posted on 2006-10-26
3
Medium Priority
?
1,714 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1500 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

656 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