CODE
class Overload
{
public 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 Over extends Overload {
void test(int a, int b) {
System.out.println("a and b: " + a + "," + b); }
}
class MethodOverloading {
public static void main(String args[]) {
Over overload = new Over();
double result;
overload.test(10);
overload.test(10, 20);
result = overload.test(5.5);
System.out.println("Result : " + result);
}
}
OUTPUT DISPLAY
0 comments:
Post a Comment