Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

number format

 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following code:


I am confused to why I am getting the following output to screen:

Account details for:
********************
This is the decimal format to two places: 600.00
Formating currency: java.text.DecimalFormat@67500
Steven Peter Charlton : Account No: 8945 Balance: 600.00

In particular the following line:
Formating currency: java.text.DecimalFormat@67500

Could someone please explain?
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DecimalFormat doesn't implement the toString method and therefore uses the one inherited by Object. Take a look at the JavaDoc for both classes...
 
Maureen Charlton
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ilja Preuss, many thanks for your post.

Got the following code to work successfully:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic