aspose file tools*
The moose likes Beginning Java and the fly likes BigDecimal - am I missing something obvious? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "BigDecimal - am I missing something obvious?" Watch "BigDecimal - am I missing something obvious?" New topic
Author

BigDecimal - am I missing something obvious?

Dorcas Rebanha
Greenhorn

Joined: Apr 04, 2007
Posts: 18
I have the following code:

BigDecimal smallPercent = new BigDecimal (20.2);
EquipmentContributionDeclaration anEquiContDecl =
new EquipmentContributionDeclaration();
anEquiContDecl.setContributionPercentage(smallPercent);
System.out.println(anEquiContDecl.getContributionPercentage().toString());

Where contributionPercentage is an attribute of type BigDecimal in the EquipmentContributionDeclaration class.

It seems like the getter and setter should work in the usual way, but the result of the println is 0. Just plain 0.

Is there something mysterious or esoteric about BigDecimal that I am missing?

Thanks.

Dorcas
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18993
    
    8

Originally posted by Dorcas Rebanha:
It seems like the getter and setter should work in the usual way
You would think so. But the mystery is more likely to be in the details of the getter and setter. Have a look there first.
Dorcas Rebanha
Greenhorn

Joined: Apr 04, 2007
Posts: 18
Thanks. Others on my team narrowed it down to a mysterious problem with the setter. It's not my job to pursue that problem, but others will do so.

Dorcas
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BigDecimal - am I missing something obvious?