class MethodOverloading
{
public static void main(String s[])
{
print();
print(8);
print(20 < 10);
}
public static void print()
{
System.out.println("Called print with no parameters");
}
public static void print(int i)
{
System.out.println("Called print with int parameter");
}
public static void print(boolean b)
{
System.out.println("Called print with boolean parameter");
}
}
A. |
Called print with no parameters |
B. |
Compilation Error - Since we can not have same method name print for 3 methods |
C. |
Compilation Error - Since we need to have a different return type for each method |
D. |
Called print with no parameters |
If you need explanation Read this topic
If you need Answer Take test on this topic