Q. What is the output of the below Java program trying to overload a method "jump"?
Code:class Rabbit{ }
class WildRabbit extends Rabbit{ }
public class MethodOverloading4
{
Rabbit jump()
{
System.out.println("Rabbit Jump");
return new Rabbit();
}
WildRabbit jump()
{
System.out.println("Wild Rabbit Jump");
return new WildRabbit();
}
public static void main(String[] args)
{
MethodOverloading4 obj = new MethodOverloading4();
obj.jump();
}
}
β
Correct Answer: (C)
Compiler error