Method Overloading
Harsh Gaikwad
XR Developer@Virtual Elements Studio XR Game Developer ll Unreal Engine Game developer || AI Systems ll Unity ll Blender 3d || UEFN || Android developer
public class Challenge30day4 {
? ? public static int area(int a){
? ? ? ? System.out.println("Area of Square is " + (a*a));
? ? ? ? return -1;
? ? }
? ? public static int area(int length,int breadth){
? ? ? ? System.out.println("Area of Rectangle is " +(length*breadth) );
? ? ? ? return -1;
? ? ? ?
? ? }
? ? public static float area(float radius){
? ? ? ? float pi=3.14f;
? ? ? ? float area1=pi*radius*radius;
? ? ? ? System.out.println("Area of Circle is "+ (area1));
? ? ? ? return -1;
? ? }
? ? public static void main(String args[]){
? ? ? ? int square=area(8);
? ? ? ? int Rectangle=area(32, 45);
? ? ? ? float circle=area(12.23f);
? ? ? ? System.out.println("The area of Square is "+ square);
? ? ? ? System.out.println("The area of rectangle is "+ Rectangle);
? ? ? ? System.out.println("The area of Circle is "+ circle);
? ? }
? ? ? ? ? ?
? ? ? ?
}
Hello Harsh... We post 100's of job opportunities for developers daily here. Candidates can talk to HRs directly. Feel free to share it with your network. Visit this link - https://jobs.hulkhire.com And start applying.. Will be happy to address your concerns, if any