File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes number format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "number format" Watch "number format" New topic
Author

number format

Maureen Charlton
Ranch Hand

Joined: Oct 04, 2004
Posts: 218
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

Joined: Jul 11, 2001
Posts: 14112
DecimalFormat doesn't implement the toString method and therefore uses the one inherited by Object. Take a look at the JavaDoc for both classes...


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Maureen Charlton
Ranch Hand

Joined: Oct 04, 2004
Posts: 218
Ilja Preuss, many thanks for your post.

Got the following code to work successfully:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: number format
 
Similar Threads
Having trouble understanding an error code i keep getting. Please help!
Problem in Decimal Percent Formating
Require output to 2 decimal places
Prob in Decimal formating
Keyboard UK and autoexec