Method Overloading

Method Overloading

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image


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

回复

要查看或添加评论,请登录

Harsh Gaikwad的更多文章

  • What is Pass by Reference?

    What is Pass by Reference?

    //Code on Array I know I have not given You idea about arrays and their declaration but i still suggest u try this code…

  • Pass By Value??

    Pass By Value??

    //Swapping Code //try declaring the call values in main and local function both and see the differenece public class…

    1 条评论
  • Competitive Coding Experience

    Competitive Coding Experience

    Hey, Connections..

    1 条评论
  • Codes and Problems on Functions

    Codes and Problems on Functions

    So Hey Connections Sorry for the Delay..

    1 条评论
  • What are Functions?

    What are Functions?

    A function is basically a type of method that returns a value after performing its task. The thing is people usually…

  • First Slot of Java Programming

    First Slot of Java Programming

    So hey Connections.Hi there!!! So am bringing up a 30 days Java programming Code Challenge Where we gonna learn and…

    1 条评论

社区洞察

其他会员也浏览了