How to Return Circle Area in Java


In this example we will show how to calculate area of circle using it’s radius.

Source Code

package com.beginner.examples;

public class CircleAreaExample {

    public static void main(String[] args){
    	
    	int r = 10;
    	//return area of a circle.
    	double area = Math.PI * r * r;
		
		System.out.println("Arae of a circle is " + area);
    }
}

Output:

Arae of a circle is 314.1592653589793
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments