Answers for "what is overload in java"

0

Method overloading in Java

public void Square ( int number ) 
{
 int square = number * number;
 System.out.printIn(“Method with Integer Argument Called:“+square);
 }
public void Square(double number)
 {
 double square = number * number; 
System.out.printIn(“Method with double Argument Called:“+square);
}
public void Square(long number)
 { 
long square = number * number;
System.out.printIn(“Method with long Argument Called:“+square);
}
Posted by: Guest on July-26-2021
1

exp on mathed overlading in java

class DisplayOverloading2
{
    public void disp(char c)
    {
        System.out.println(c);
    }
    public void disp(int c)
    {
       System.out.println(c );
    }
}

class Sample2
{
    public static void main(String args[])
    {
        DisplayOverloading2 obj = new DisplayOverloading2();
        obj.disp('a');
        obj.disp(5);
    }
}
Posted by: Guest on November-02-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language