Notice: Constant WP_MEMORY_LIMIT already defined in /home/javawith/public_html/codesjava.com/wp-config.php on line 107

Notice: Constant WP_MAX_MEMORY_LIMIT already defined in /home/javawith/public_html/codesjava.com/wp-config.php on line 108
Calculate circle area using java - CodesJava

CodesJava

Easy learning with example program codes

Calculate Circle Area using Java Example


Notice: Undefined variable: footnotelist in /home/javawith/public_html/codesjava.com/wp-content/plugins/latex2html/inc/core.php on line 475

 
Area of a circle = pi * r * r.
where:
r is the radius of the circle.
pi is a mathematical constant.

Program to Calculate Circle Area using Java.

/**
 * Program to Calculate Circle Area using Java Example.
 * @author CodesJava
 */
public class CirleAreaExample {
	static void circleArea(int radius){
		 double area = Math.PI * radius * radius;
         //Print Circle Area.
         System.out.println("Circle area: " + area);
	}	
 
	public static void main(String args[]){ 
		//method call 
		circleArea(20); 
	}
}

Output:

Circle area: 1256.6370614359173

 

Please follow and like us:
error
Posted in Java   

Core Java Tutorial








Copyright © 2019 CodesJava DMCA.com Protection Status