What is Circle?
A circle is a round shaped figure that has no corners or edges. If you have a radius for a circle, you could easily find out Area, Diameter and Circumference for a Circle.
Here are the formulas for the Circle.
Area: A=πr2 (π = 3.14)
Perimeter (Circumference): C=2πr (π = 3.14)
Diameter: d=2r
Here is a simple Java program to find out Diameter, Area and Circumference of any given circle provided you have radius.
Create class CrunchifyCircleDiameterAreaCircumference.java
Result:
Just run above program as a Java Program in Eclipse or IntelliJ IDEA.
Let us know if you face any issue running above program.
The post How to find Diameter, Area and Perimeter (Circumference) for a Circle in Java? appeared first on Crunchify.
More Related Articles For You...
How to Find Factorial of a given number using recursion in Java?
CrunchifyJSONtoHTML.js – JSON to HTML table Converter Script
In Java how to join Arrays? 3 ways: Apache Commons ArrayUtils, Java 8 Streams and Simple APIs