This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Java in General and the fly likes java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal" Watch "java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal" New topic
Author

java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal

Kanwardeep Singh
Greenhorn

Joined: Dec 06, 2012
Posts: 10
I am getting a BigDecimal Through a getter method and putting that into a Map<String,Object[]>
that bigdecimal is part of the Object[] Array.
but i am getting this ClassCastException.

While fetching that array value and setting into Object[]
Map<String,Object[]> map=HashMap<String,Object[]>();
map.put("1",new Object[] { l_obj.getValueOfBigDecimal()})
I am getting this Execption.

Can anyBody help?
James Boswell
Ranch Hand

Joined: Nov 09, 2011
Posts: 657
    
    2

Can you show the full stacktrace please? That will give us a better idea as to where the problem is occurring. I suspect there is an issue with your get method.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32833
    
    4
Are you putting the BigDecimal object into the Object[] or into the Map?
Kanwardeep Singh
Greenhorn

Joined: Dec 06, 2012
Posts: 10
yes..i am putting BigDecimal into Object[] ar. and Object[] ar i am putting into Map.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16487
    
    2

But the exception would be thrown when you are getting the data out of the map, so why aren't we seeing that code? James Boswell asked you to post it quite a long time ago.
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: java.lang.ClassCastException: java.lang.String cannot be cast to java.math.BigDecimal
 
Similar Threads
Not seeing properties in JSP
Convert String to BigDecimal
Iterating a hashmap in jsp using struts2
Getting SOAPMessage as null
Arithmetic operations with large numbers