double
type is for Double precision.
double
type uses 64 bits to store a value.
Here is a short program that uses double
variables to compute the area of a circle:
public class Main {
public static void main(String args[]) {
double pi, r, a;
r = 10.8888; // radius of circle
pi = 3.1415926; // pi, approximately
a = pi * r * r;
System.out.println("Area of circle is " + a);
}
}
The output:
Area of circle is 372.4859596381597
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |