title: Overloaded static methods that calculate the area of various shapes, duplicate method warning
body: <p>I am reading <em>Starting out with Java</em> and a challenge presented in the book is to: "Write a class that has three overloaded static methods for calculating the areas of the following geometric shapes: circles, rectangles and cylinders."  The area of a circle only requires only one parameter and there was no issue here so I left that method out. But the area of a rectangle and the area of a cylinder both require two parameters:</p>
  
  <pre><code>public class Area{
      public static double area(double w, double l)
      {
        //Area of rectangle
          return l*w;
      }
      public static double area(double r, double h)
      {
        //Area of a cylinder
          return Math.PI * (r*r) *h;
      }
  }
  </code></pre>
  
  <p>With the above code I get the warning "<code>duplicate method area(double, double) in type Area."</code> I know that if I simply change the type of one of the parameters I won't have this issue, but is this the only way it can be done? I can't have two overloaded static methods with the same parameter list? </p>