import java.util.*;
import java.io.*;
class Overloading
{
void Test()
{
System.out.println("No. Parameters::");
}
void Test(int a)
{
System.out.println("a:"+a);
}
void Test(int a,int b)
{
System.out.println("a and b:"+a+" "+b);
}
double Test(double a)
{
System.out.println("double a::"+a);
return a*a;
}
}
class Overload
{
public static void main(String args[])
{
Overloading o1=new Overloading();
double result;
o1.Test();
o1.Test(10);
o1.Test(10,20);
result=o1.Test(123.25);
System.out.println("result:::"+result);
}
}
Output:
No comments:
Post a Comment