This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BigDecimal - am I missing something obvious?

 
Dorcas Rebanha
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Pie
Posts: 20955
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic