Computer Science, asked by benzilfdesp26fgx, 7 months ago

2. Method overloading –
Implement a class named Rectangle. Write three methods that compute the area of the Rectangle. The 1st area methods takes two parameters (length and breadth – user input). The 2nd area method take the 1st parameter length from user and 2nd parameter was initialized in the area method itself. The 3rd area method initializes both the values of length and breadth in the area method itself (hard coded). Also create another method to display the area of the reactangle.​

Answers

Answered by nishitathangadurai20
1

Explanation:

This program finds the area of square, rectangle and circle using method overloading. In this program we have three methods with same name area(), which means we are overloading area() method. By having three different implementation of area method, we are calculating the area of square, rectangle and circle.

To understand this program you should have the knowledge of following Core Java topic:

Method Overloading in Java

Similar questions