This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes preserve double precision Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "preserve double precision" Watch "preserve double precision" New topic

preserve double precision

Saritha Reddy

Joined: Jun 17, 2004
Posts: 8

I declared a variable double as

double d=5;

when I print it, I get as 5.0.I want 5.00.

Can some one help me how to preserve the precition

Thaks in advance
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Check java.text.DecimalFormat class

Quaerendo Invenietis
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608

Tony Morris
Java Q&A (FAQ, Trivia)
Consider Paul's rocket mass heater.
subject: preserve double precision
Similar Threads
addition accuracy
Wrapper class
UBB code quote
equation problem
Rotating buffered image