This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes having problem with storing a double value... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "having problem with storing a double value..." Watch "having problem with storing a double value..." New topic
Author

having problem with storing a double value...

raghu tammina
Ranch Hand

Joined: Jul 11, 2012
Posts: 60
Hi,

I am storing a double value 9999 to database.when i am retrieving the value i'm getting is '9999' but i want 9999.0.

help me how to get it.

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14913
    
  26

A number is just a number. It doesn't have a format by itself. There's no difference between a double that holds the value '9999' and one thatholds the value '9999.0'. When you convert the number to a string, in order to display it, then you specify how it should be formatted, for example with a certain number of decimal digits.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: having problem with storing a double value...
 
It's not a secret anymore!