Java Program to Find Area of circle Using Method Overloading Last Updated : 28 Jul, 2022 Comments Improve Suggest changes Like Article Like Report A circle is a simple shape consisting of all the points in the plane that are equidistant from a point known as the center of the circle. In this article, we will learn how to find the area of the circle using the method overloading. Terminology: Method Overloading: Method overloading allows different methods to have the same name, but different signatures where the signature can differ by the number of input parameters or type of input parameters or both. Area: A quantity that represent the extent of a 2-dimensional figure or shape in the plane is known as an area.Radius: The line segment from the center to any point of the circle is known as radius.Diameter: The line segment whose endpoints lie on the circle and passed through the center is known as the diameter of the circle. It is also known as the largest distance between any two points on the circle.Area of the Circle The area of the circle is the product of the square of the radius of the circle and the value of PI. We can simply calculate the area of the circle using the following formula: Using the radius of the circle: Formula: Area of the circle: A = π * r2 Here, r is the radius of the circle. Using the diameter of the circle: Formula: Area of the circle: A = (π / 4) * d2 Here, r is the radius of the circle. Note: The value of PI in java is 3.141592653589793. Below is the implementation of the above approach: Example 1: Java // Java program to find the area of // the circle using Method Overloading import java.io.*; class Circle { static final double PI = Math.PI; // Overloaded Area() function to // calculate the area of the circle. // It takes one double parameter void Area(double r) { double A = PI * r * r; System.out.println("Area of the circle is :" + A); } // Overloaded Area() function to // calculate the area of the circle. // It takes one float parameter void Area(float r) { double A = PI * r * r; System.out.println("Area of the circle is :" + A); } } class GFG { // Driver code public static void main(String[] args) { // Creating object of Circle class Circle obj = new Circle(); // Calling function obj.Area(5); obj.Area(2.5); } } OutputArea of the circle is :78.53981633974483 Area of the circle is :19.634954084936208 Time Complexity: O(1) Auxiliary Space: O(1) Example 2: Java // Java program to find the area of // the circle when the diameter is given // using Method Overloading import java.io.*; class Circle { static final double PI = Math.PI; // Overloaded Area() function to // calculate the area of the circle. // It takes one double parameter void Area(double D) { double A = (PI / 4) * D * D; System.out.println("Area of the circle is :" + A); } // Overloaded Area() function to // calculate the area of the circle. // It takes one float parameter void Area(float D) { double A = (PI / 4) * D * D; System.out.println("Area of the circle is :" + A); } } class GFG { // Driver code public static void main(String[] args) { // Creating object of Circle class Circle obj = new Circle(); // Calling function obj.Area(10); obj.Area(20.4); } } OutputArea of the circle is :78.53981633974483 Area of the circle is :326.851299679482 Time complexity: O(1) since performing constant operations Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article Java Program to Find Area of circle Using Method Overloading ankita_saini Follow Improve Article Tags : Java Java Programs Practice Tags : Java Similar Reads Java Program to Find Area of Square Using Method Overloading A square is a simple flat shape in a plane, defined by four points at the four corners. It has four sides with equal length and four corners with right angles. Method Overloading: Method overloading allows different methods to have the same name, but different signatures where the signature can diff 3 min read Java Program to Find Area of Rectangle Using Method Overloading A rectangle is a simple flat figure in a plane. It has four sides and four right-angles. In a rectangle all four sides are not of equal length like a square, sides opposite to each other have equal length and both the diagonals of the rectangle have equal length. Method overloading allows different 2 min read Java Program to Find the Perimeter of a Circle A circle is a simple shape consisting of all the points in the plane that are equidistant from a point known as the center of the circle. In this article, we will learn how to find the area of the circle. Terminology: Perimeter: A quantity of measurement or boundary of the circle. It is basically th 2 min read Java Program to Find the Area of a Triangle A triangle is a polygon. It has three edges and three vertices and each vertex from an angle. It is a closed 2-dimensional shape. In this article, we will learn how to find the area of the triangle.There can be two possibilities while calculating the area of the triangle as per casesUsing the height 3 min read Java Program to Find the Area of Parallelogram A parallelogram is a special type of quadrilateral that has equal and parallel opposite sides. The diagonals of a parallelogram bisect each other at 90 degrees. The area of a figure can be defined in geometry as the space occupied by a flat shape. A figure's area is the number of unit squares that c 3 min read Java Program to Find out the Area and Perimeter of Rectangle using Class Concept The perimeter is the length of the outline of a shape. To find the perimeter of a rectangle or square you have to add the lengths of all four sides. x is in this case the length of the rectangle while y is the width of the rectangle. The area is the measurement of the surface of a shape. The main ta 3 min read Java Program to Find the Area of a Circle Given the Radius A circle is a simple shape consisting of all the points in the plane that are equidistant from a point known as the center of the circle. In this article, we will learn how to find the area of the circle. Terminology: Area: A quantity that represents the extent of a 2-dimensional figure or shape in 2 min read Java Program to Find the Area of Rhombus A rhombus is a quadrilateral whose four sides all have the same length and a rhombus is also called an equilateral quadrilateral. The formula for finding the area of a rhombus is as follows: (product of the lengths of the diagonals)/2 Example: Input : p = 2, q = 3 Output: 3Input : p = 4, q = 5 Outpu 1 min read Java Program to Calculate and Display Area of a Circle Given a radius of the circle, write a java program to calculate and display the area of the circle. (Take â=3.142) Example Input : radius= 5 Output: Area of circle is : 78.55 Input : radius= 8 Output: Area of circle is : 201.08As we know to calculate the area of a circle, the radius of the circle mu 1 min read Like