//Program to demonstrate method overloading class Shape { //Overloaded method area() with no parameters void area() { System.out.println("Method with no parameters"); System.out.println("Constant values are set"); int b=5,h=4; System.out.println("Area of Triangle ="+(0.5*b*h)); } //Overloaded method area() with one parameter void area(int r) { System.out.println("Area of Circle ="+(3.142*r*r)); } //Overloaded method area() with two parameters void area(int l,int b) { System.out.println("Area of Rectangle ="+(l*b)); } } class OverloadArea { public static void main(String args[]) { Shape ob=new Shape(); ob.area(); ob.area(5); ob.area(5,2); } } /* Write a prg to overload perim() to calculate perimeter of circle(2*3.14*r) with 1 parameter, triangle(s1+s2+s3) with 3 parameters, rectangle(2*(s1+s2)) with 2 parameters. In the main method, call every method with appropriate parameters. Write a prg to overload volume() to calculate volume of cube(formula=side*3) with one parameter, volume of rectangular prism(s1*s2*s3) with 3 parameters, volume of cylinder(3.14*r2*h) with 2 parameters */