Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

having problem with storing a double value...

 
raghu tammina
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic