Calculate Circle Area in Java
Description
The following code shows how to calculate Circle Area.
Example
//from w w w . java 2s .c om
public class Main {
public static void main(String[] args) {
double r = 0.9;
double area = Math.PI * (r * r);
System.out.println("The area is " + area);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »